ForHosting KIT · Math

Endpoint calculator

If one end of a segment is at (0, 0) and its midpoint is at (2, 3), the other end is at (4, 6). Enter the known end and the midpoint to get the missing point, reflected through the centre. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
X1
0
Y1
0
Mx
2
My
3
You get
X2
4
Y2
6

Every coordinate is validated as a finite number before any arithmetic happens, so malformed input is rejected with a clear error instead of producing a silent NaN.

From the midpoint formula to the missing end

The midpoint of a segment is the average of its two ends: its x is half the sum of the two x values, and the same goes for y. If you know the midpoint and one end, you can run that rule backwards. Multiply the midpoint coordinates by two to get the sum of both ends, then take away the end you already have. What remains is the end you are missing. With a known end at (0, 0) and a midpoint at (2, 3), doubling gives (4, 6), and taking away zero leaves (4, 6). It is the exact reverse of finding a midpoint.

When you need it and what to watch for

The typical case is a symmetric pair where only one side was measured: a far station in a survey, a mirrored corner in a drawing, the twin of an anchor point in a page layout. The most common slip is mixing up the roles of the two points you enter, giving the midpoint as the known end or the other way round, which puts the answer in the wrong place. Each of the four coordinates must be a real number; anything missing or not a number is refused with a clear message instead of a meaningless result. Answers are rounded to ten decimal places.

Validation and numeric behavior

Every one of the four coordinates — x1, y1, mx and my — must be present and must be a finite number. Results are rounded to ten decimal places so that the output is byte-stable across machines and runtimes; a floating-point artifact like 0.1 + 0.2 never leaks into the response. Because the whole computation is four multiplications and subtractions of validated numbers, the result is fully deterministic: the same input always yields the same output, with no randomness, no clock and no external service involved.

Where it fits in real work

In computer graphics and CAD, an object mirrored about a pivot point needs its reflected vertices, and reflecting through a point is exactly this operation. In surveying and mapping, a station measured from a known control point with a recorded midpoint lets you recover the far station without a second trip. In game development and animation, it places the counterpart of an entity across a center of rotation, and in layout engines it completes a symmetric pair of anchor points.

Complete a symmetric measurement

Recover a far station or anchor from a known control point and a recorded midpoint when only one side of the segment was measured directly.

What input does it expect?

Plain numbers or numeric strings are both accepted.

How do you find the other end of a segment from the midpoint?

Double each midpoint coordinate and subtract the matching coordinate of the known end. With a known end at (0, 0) and a midpoint at (2, 3), that gives 4 for x and 6 for y.

Why is finding the missing end point a reflection?

Because the midpoint is the centre of symmetry of the segment. The missing end is the mirror image of the known end through the midpoint, the same distance away on the opposite side.

Where is this calculation used outside the classroom?

In drawing and design software to mirror a shape about a pivot point, in surveying to recover a far station from a control point and a recorded midpoint, and in games to place the counterpart of an object across a centre of rotation.

How precise is the result?

Results are rounded to ten decimal places, so tiny leftovers from decimal arithmetic never show up, and the same four coordinates always give exactly the same point.

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.

POSThttps://api.kit.forhosting.com/math/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.

curl -X POST https://api.kit.forhosting.com/math/endpoint \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"x1":0,"y1":0,"mx":2,"my":3}'
{
  "x1": 0,
  "y1": 0,
  "mx": 2,
  "my": 3
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "math.endpoint",
  "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.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

The endpoint calculator solves one of the most common coordinate geometry problems in a single call: you know one endpoint of a line segment and you know its midpoint, and you need the other endpoint. Send the known endpoint A=(x1, y1) and the midpoint M=(mx, my), and the API returns the missing endpoint B=(x2, y2) by reflecting A through M with the rearranged midpoint formula, x2 = 2·mx − x1 and y2 = 2·my − y1. It is the exact inverse of a midpoint calculator: instead of averaging two endpoints to find the center, it doubles the center and subtracts the known end to recover the missing one.

The midpoint formula, rearranged

When the missing piece is B rather than M, the same two equations are simply solved for x2 and y2. The midpoint M of a segment joining A=(x1, y1) and B=(x2, y2) is the average of the endpoints: mx = (x1 + x2) / 2 and my = (y1 + y2) / 2. Multiplying both sides by two gives x1 + x2 = 2·mx, and subtracting x1 isolates the unknown: x2 = 2·mx − x1. The same step on the y axis gives y2 = 2·my − y1. Geometrically this is a reflection: the midpoint is the center of symmetry of the segment, so the missing endpoint is the mirror image of the known endpoint through M. That is why the operation is sometimes called reflecting a point through another point, and why the result is always exactly as far from M as the known endpoint is, on the opposite side. The calculator performs both rearrangements in one pass and returns the known endpoint, the midpoint and the recovered endpoint together, so the input and the answer can be checked side by side without a second call.

Validation and numeric behavior

Plain JSON numbers are accepted, and so are numeric strings such as "3.5", which is convenient when the value comes straight out of a form field or a CSV cell. Missing fields, empty strings, booleans, NaN, Infinity and non-numeric text are all rejected with an invalid_input error that names the offending coordinate, and requests that fail validation are never billed. Coordinates are accepted up to an absolute magnitude of 1e15, far beyond any practical geometry workload, and the computed endpoint is itself checked for finiteness before being returned.

Where it fits in real work

Missing-endpoint problems appear wherever symmetry or centering matters. In education, it is the standard homework companion to the midpoint formula: students are given A and M and asked for B, and this endpoint doubles as an answer checker. The API runs on our global edge with nothing stored after the response, and the very same code runs free in your browser on this page, so you can verify a single case interactively and only pay — $0.002 per request — when you automate it at scale.

Mirror a point through a pivot

Reflect a vertex or sprite across a center point in graphics, CAD or game code: the pivot is the midpoint and the mirrored vertex is the missing endpoint.

Check midpoint homework answers

Given one endpoint and the midpoint, students recover the other endpoint and verify their manual rearrangement of the midpoint formula.

What does it cost?

$0.002 per request. It is also free to run in your browser on this page.

What formula does it use?

The rearranged midpoint formula: x2 = 2·mx − x1 and y2 = 2·my − y1. The missing endpoint is the reflection of the known endpoint through the midpoint.

What happens with invalid input?

Any missing or non-finite coordinate — NaN, Infinity, empty or non-numeric text — is rejected with an invalid_input error naming the field, and failed requests are not billed.

How is this different from a midpoint calculator?

A midpoint calculator averages two endpoints to find the center. This one is the inverse: it takes one endpoint and the center, and recovers the other endpoint.

Is anything stored?

No. The coordinates are processed and discarded; only the computed endpoint is returned.

Read the full KIT documentation →