# Thin Lens Equation Calculator

> Solves the thin-lens / mirror equation 1/f = 1/d_o + 1/d_i for the image distance of a converging or diverging lens, or a concave or convex mirror, and reports the magnification, image height and whether the image is real or virtual, inverted or upright, enlarged or reduced.

- Calculator id: `lens-equation` · Category: Physics (`physics`) · Tool name: `solve_thin_lens_equation`
- Canonical page: https://tttkmbb.com/physics/lens-equation · This document: https://tttkmbb.com/physics/lens-equation.md · JSON definition: https://tttkmbb.com/physics/lens-equation.json

## Purpose

Solves the thin-lens / mirror equation 1/f = 1/d_o + 1/d_i for the image distance of a converging or diverging lens, or a concave or convex mirror, and reports the magnification, image height and whether the image is real or virtual, inverted or upright, enlarged or reduced.

**Use when:** You know the focal length of a lens or curved mirror and the object distance and need where the image forms, how large it is and its character (real/virtual, upright/inverted).

**Do not use when:** The lens is thick or part of a multi-element system, you need the focal length from surface curvatures (lensmaker's equation), or you need refraction angles at a flat surface (use snells-law).

## Input

| Parameter | Type | Unit | Required | Description |
| --- | --- | --- | --- | --- |
| `optic` | enum: converging_lens \| diverging_lens \| concave_mirror \| convex_mirror |  | required | Type of optic; it sets the sign of the focal length (converging lens and concave mirror positive, diverging lens and convex mirror negative). |
| `focal_length_cm` | number | cm | required | Magnitude of the focal length in centimetres, always positive; the sign is applied from optic. For a spherical mirror f = R / 2. (> 0) |
| `object_distance_cm` | number | cm | required | Distance from the object to the lens or mirror in centimetres (a real object, always positive). (> 0) |
| `object_height_cm` | number | cm | optional, default 1 | Height of the object in centimetres (default 1, so image_height_cm equals the magnification). (> 0) |

## Output

| Field | Type | Unit | Description |
| --- | --- | --- | --- |
| `focal_length_signed_cm` | number | cm | Focal length with the sign convention applied: positive for converging lens and concave mirror, negative for diverging lens and convex mirror. |
| `image_distance_cm` | number | cm | d_i = 1 / (1/f − 1/d_o), signed: positive = real image, negative = virtual image (see image_location_note). |
| `magnification` | number |  | m = −d_i / d_o; negative means inverted, \|m\| > 1 enlarged. |
| `image_height_cm` | number | cm | m × object_height_cm, signed (negative = inverted). |
| `image_type` | string |  | real (light actually converges there, can be projected on a screen) or virtual (appears to come from that point). |
| `orientation` | string |  | inverted (m < 0) or upright (m > 0) relative to the object. |
| `size` | string |  | enlarged (\|m\| > 1), reduced (\|m\| < 1) or same size (\|m\| = 1). |
| `image_location_note` | string |  | Where the image lies and what the sign of image_distance_cm means for this optic. |

## Formula

`1 / f = 1 / object_distance_cm + 1 / image_distance_cm with f = +focal_length_cm (converging lens, concave mirror) or −focal_length_cm (diverging lens, convex mirror); magnification = −image_distance_cm / object_distance_cm; image_height_cm = magnification × object_height_cm`

Gaussian thin-lens and mirror equations in the real-is-positive convention (paraxial rays, negligible lens thickness): for lenses a positive image distance lies on the far side of the lens, for mirrors in front of the mirror; an object exactly at the focal point gives an image at infinity and is rejected.

## Data Sources

- Wikipedia – Thin lens (thin lens equation) — https://en.wikipedia.org/wiki/Thin_lens (reference, retrieved 2026-09-24)
- Wikipedia – Curved mirror (mirror equation) — https://en.wikipedia.org/wiki/Curved_mirror (reference, retrieved 2026-09-24)
- HyperPhysics – Thin lens equation — http://hyperphysics.phy-astr.gsu.edu/hbase/geoopt/lenseq.html (reference, retrieved 2026-09-24)

Data freshness: `static`. Deterministic formula with fixed constants; results never go stale. Inputs supplied by the caller determine the output.

## API

- `GET https://tttkmbb.com/api/v1/calculate/lens-equation?optic=…&focal_length_cm=…&object_distance_cm=…`
- `POST https://tttkmbb.com/api/v1/calculate/lens-equation` with JSON body `{"inputs": {…}}`
- Response: unified envelope (`success`, `request`, `result.values`, `result.units`, `sources`, `freshness`, `timestamp`, `next_actions`, `links`); see https://tttkmbb.com/docs/response-format.md
- Schema: https://tttkmbb.com/api/v1/calculators/lens-equation · OpenAPI operationId `solve_thin_lens_equation` in https://tttkmbb.com/openapi.json
- Authentication: none. Rate limit: fair use, see https://tttkmbb.com/docs/rate-limits.md.

## MCP

- Server: `https://tttkmbb.com/mcp` (Streamable HTTP, JSON-RPC 2.0, no auth)
- Tool:  `run_calculator` with `{"calculator_id": "lens-equation", "inputs": {…}}`

## Example

- Converging lens f = 10 cm, object at 15 cm: inputs `{"optic":"converging_lens","focal_length_cm":10,"object_distance_cm":15}` → `{"focal_length_signed_cm":10,"image_distance_cm":30,"magnification":-2,"image_height_cm":-2,"image_type":"real","orientation":"inverted","size":"enlarged"}`
- Convex mirror f = 10 cm, object at 20 cm: inputs `{"optic":"convex_mirror","focal_length_cm":10,"object_distance_cm":20}` → `{"focal_length_signed_cm":-10,"image_distance_cm":-6.6667,"magnification":0.3333,"image_height_cm":0.3333,"image_type":"virtual","orientation":"upright","size":"reduced"}`

```
GET https://tttkmbb.com/api/v1/calculate/lens-equation?optic=converging_lens&focal_length_cm=10&object_distance_cm=15
```

## Limitations

The lens is thick or part of a multi-element system, you need the focal length from surface curvatures (lensmaker's equation), or you need refraction angles at a flat surface (use snells-law). Gaussian thin-lens and mirror equations in the real-is-positive convention (paraxial rays, negligible lens thickness): for lenses a positive image distance lies on the far side of the lens, for mirrors in front of the mirror; an object exactly at the focal point gives an image at infinity and is rejected. All values are computed from the formula above; no measurement or live data is involved.

## FAQ

**What happens when the object is inside the focal length of a converging lens?**

The image becomes virtual, upright and enlarged, as in a magnifying glass: f = 10 cm and d_o = 5 cm give d_i = −10 cm and m = +2.

**How do I get the focal length of a mirror?**

For a spherical mirror f = R / 2, half the radius of curvature; enter the magnitude and pick concave_mirror or convex_mirror to set the sign.

**Why is the image distance negative?**

A negative d_i is a virtual image: for a lens it lies on the same side as the object (seen by looking through the lens), for a mirror behind the mirror surface. Diverging lenses and convex mirrors always give virtual, upright, reduced images of real objects.

## Related

- [Snell's Law Calculator](https://tttkmbb.com/physics/snells-law.md) — Refraction at a single flat surface, the basis of lens action.
- [Wavelength & Frequency Calculator](https://tttkmbb.com/physics/wavelength-frequency.md) — Wavelength and frequency of the light used.
