Center of an ellipse
Get the center of an ellipse straight from its general equation: 4x² + 9y² − 8x − 36y + 4 = 0 is centered at (1, 2). The equation is first checked to be a real ellipse, and rotated ones work too. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- A
- 4
- B
- 0
- C
- 9
- D
- -8
- E
- -36
- F
- 4
- H
- 1
- K
- 2
- Discriminant
- -144
Before returning anything it verifies that the equation actually is an ellipse: the discriminant B^2 − 4AC must be negative, and the curve must be real and non-degenerate. Rotated ellipses, with a non-zero xy term, are handled exactly the same way as axis-aligned ones.
From general form to a point you can use
Textbook ellipse equations arrive in standard form, (x − h)^2/a^2 + (y − k)^2/b^2 = 1, where the center simply reads off as (h, k). Real-world equations rarely do. Doing it by hand means setting the partial derivatives to zero and solving a two-by-two linear system — simple, but tedious, and easy to get wrong when signs are involved.
You send the six coefficients, and you receive the center coordinates rounded to a stable precision, together with the discriminant and the formulas used, so the result can be checked and cited rather than trusted blindly. Only A, C and F are strictly required; B, D and E default to zero when omitted, which covers ellipses centered at the origin with a shorter request.
How the center is recovered from the coefficients
Solving that linear system gives h = (BE − 2CD)/(4AC − B^2) and k = (BD − 2AE)/(4AC − B^2), and the denominator is exactly why the ellipse condition matters: 4AC − B^2 must be positive, which is the same as saying the discriminant B^2 − 4AC is negative. But the discriminant test alone does not guarantee a drawable ellipse. The solver therefore also evaluates the conic at its own center.
If that value is zero, the curve has collapsed to a single point — a degenerate ellipse. If the value has the same sign as A + C, the curve is imaginary: algebraically ellipse-shaped, but with no real points at all.
Where it fits in a pipeline
Use it wherever conic coefficients appear and a concrete point is needed downstream. A vision system that fits an ellipse to detected edge pixels gets coefficients out of the least-squares step; this call turns them into the center used for tracking or measurement. A CAD or geometry service can normalize rotated ellipse equations without implementing the algebra itself.
An educational tool can check a student's completed-square answer against the true center. The capability is deterministic — the same coefficients always return the same coordinates, with no sampling and no randomness — so it is safe to assert against in tests.
What you can do with it
Post-process an ellipse fit from computer vision
Least-squares ellipse fitting returns general conic coefficients; recover the center in one call for tracking, measurement or overlay rendering.
Normalize rotated conic equations in a geometry service
When the xy term is not zero, the center is no longer obvious — the solver handles B ≠ 0 with the same closed-form formulas.
FAQ
What does it cost?
The same solver also runs free in your browser on this page.
Which equation form does it accept?
A, C and F are required; B, D and E default to zero when omitted.
How is the center computed?
By solving the stationary-point system 2Ah + Bk = −D and Bh + 2Ck = −E, giving h = (BE − 2CD)/(4AC − B^2) and k = (BD − 2AE)/(4AC − B^2).
What happens if the equation is not an ellipse?
The discriminant B^2 − 4AC must be negative, and degenerate (single-point) or imaginary ellipses are also rejected with a message that says which case it is.
Does it work with rotated ellipses?
Yes. A non-zero B coefficient (the xy term) indicates rotation and is handled by the same formulas; no special mode is needed.
Is anything stored?
No. The coefficients are processed and discarded; only the center coordinates and the diagnostic fields are returned.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/math/center-of-ellipse \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"a":4,"c":9,"f":-36}'const res = await fetch("https://api.kit.forhosting.com/math/center-of-ellipse", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"a": 4,
"c": 9,
"f": -36
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/math/center-of-ellipse",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"a": 4,
"c": 9,
"f": -36
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/math/center-of-ellipse", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"a":4,"c":9,"f":-36}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"a":4,"c":9,"f":-36}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/math/center-of-ellipse", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"a": 4,
"c": 9,
"f": -36
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "math.center_of_ellipse",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
The center of ellipse API takes the six coefficients of a general conic equation — A, B, C, D, E and F in Ax^2 + Bxy + Cy^2 + Dx + Ey + F = 0 — and returns the coordinates (h, k) of the center of the ellipse it describes. If the equation describes a parabola, a hyperbola, a single point or no real curve at all, you get a clear typed error instead of meaningless numbers.
From general form to a point you can use
Curve fitting, computer vision, orbital mechanics and collision detection all produce the general conic Ax^2 + Bxy + Cy^2 + Dx + Ey + F = 0, where the center is buried inside the coefficients and has to be recovered. This endpoint does that derivation for you in one call.
How the center is recovered from the coefficients
The center of a conic is the point where both partial derivatives vanish: 2Ax + By + D = 0 and Bx + 2Cy + E = 0. Both cases are rejected with a typed error that names the failure, so a pipeline can tell bad geometry apart from bad input and react to each differently.
Where it fits in a pipeline
It runs on our global edge with nothing stored, and the same solver code runs free in your browser on this page: you can paste coefficients and see the result right away before you pay $0.002 per request to automate it at scale.
Integration use cases
Validate conics before accepting them
Reject parabolas, hyperbolas, point ellipses and imaginary conics with a typed invalid_input error before they poison downstream calculations.