ForHosting KIT · Math

Check similarity in right triangles

Find out whether two right triangles have the same shape: legs of 3 and 4 against legs of 6 and 8 are similar, with a scale factor of 2. You only need the legs, and a hypotenuse you add is checked too. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon

Runs in your browser. Free, unlimited — your data never leaves this page.

Two right triangles are similar when their corresponding sides are proportional — the same shape at a different scale. This capability takes the legs (and optionally the hypotenuse) of two right triangles and answers that single question deterministically: it sorts each triangle's legs, compares the leg ratios within a configurable tolerance, and returns true when the sides are proportional, together with the scale factor that maps one triangle onto the other.

What similarity means for right triangles

Similarity is one of the oldest ideas in geometry: two figures are similar when one is a uniform rescaling of the other. For right triangles the test is especially cheap because the right angle is already shared. If the ratio between the two legs of the first triangle equals the ratio between the two legs of the second, every angle matches and the triangles are similar.

Because a leg can correspond to either leg of the other triangle, the comparison sorts each pair of legs first, so a triangle with legs 3 and 4 is correctly reported as similar to one with legs 8 and 6. When the test passes, the response includes the scale factor — the single number you would multiply every side of the first triangle by to obtain the second — so you can use the result directly in further calculations instead of only learning that the shapes match.

How the comparison is computed

Each triangle is described by its two legs, with the hypotenuse optional. The comparison itself is a ratio test: the shorter leg divided by the longer leg in each triangle must agree within a relative tolerance that defaults to 1e-9 and can be widened through the tolerance field for measurements that carry rounding noise. The algorithm is fully deterministic: no randomness, no clock, no network, just arithmetic.

Where the check fits in real work

Geometry pipelines, CAD pre-processing and educational software all meet the same question: is this shape a scaled copy of that one? A tutoring platform can generate a triangle, scale it, and verify that a student's answer preserves similarity before grading. A surveying tool can confirm that a reduced drawing is faithful to the field measurements it came from.

A physics simulation can cheaply assert that two triangular elements share their angles before reusing precomputed coefficients between them.

Grade geometry exercises

Verify that a student's constructed triangle is a scaled copy of the reference triangle before awarding the point.

Validate scaled technical drawings

Confirm that a reduced or enlarged plan keeps the original proportions by checking one representative right triangle.

Dedupe triangular mesh elements

Detect triangular elements that share their angles so precomputed coefficients can be reused across the mesh.

What counts as similar?

The triangles are similar when the ratio between their two legs matches (in either order) within the relative tolerance, which means all corresponding sides are proportional.

What if I also give the hypotenuse?

It is validated against the legs with the Pythagorean theorem. A hypotenuse inconsistent with the legs is rejected as invalid input.

Which inputs are rejected?

Any side length that is zero, negative or not a finite number, and any hypotenuse that does not match its legs.

Can I loosen the comparison for measured data?

Yes. Pass a relative tolerance field — for example 0.001 — to treat ratios that agree to within a tenth of a percent as equal.

Does the order of the legs matter?

No. Each triangle's legs are sorted before comparison, so legs 3-4 and 4-3 describe the same shape and match the same triangles.

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/check-similarity-in-right-triangles

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/check-similarity-in-right-triangles \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"triangle_1":{"leg_a":3,"leg_b":4,"hypotenuse":5},"triangle_2":{"leg_a":6,"leg_b":8,"hypotenuse":10}}'
{
  "triangle_1": {
    "leg_a": 3,
    "leg_b": 4,
    "hypotenuse": 5
  },
  "triangle_2": {
    "leg_a": 6,
    "leg_b": 8,
    "hypotenuse": 10
  }
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "math.check_similarity_in_right_triangles",
  "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.

Any side length that is zero or negative, or a hypotenuse inconsistent with its legs, is rejected with a clear invalid_input error.

What similarity means for right triangles

You do not need to know the angles, the area, or the orientation — the check similarity in right triangles endpoint reduces the whole question to comparing proportions.

How the comparison is computed

If you supply the hypotenuse, the endpoint validates it against the legs using the Pythagorean theorem and rejects the input when they disagree — a hypotenuse of 6 with legs 3 and 4 is a data error, not a triangle. Legs must be positive finite numbers; zero or negative side lengths raise an invalid_input error and are never silently clamped.

Where the check fits in real work

The same code that runs on our edge also runs free in your browser on this page, so you can verify a pair of triangles interactively and only pay — $0.002 per request — when you automate the check inside your own system. The response is deliberately small: a boolean, the scale factor when the triangles are similar, and the three side ratios either way, which is enough for a pipeline to branch on without any further parsing.

What does it cost?

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

Read the full KIT documentation →