Lens and Mirror Formula Calculator with Ray Diagram (NCERT Sign Convention)

Choose a convex or concave lens or mirror, type the object distance and the focal length, and this calculator finds the image distance, magnification, image height and the nature of the image. It also draws the ray diagram with the principal axis to scale. It uses the New Cartesian sign convention exactly as in the NCERT books for Class 10 (Light – Reflection and Refraction) and Class 12 (Ray Optics and Optical Instruments). You can also find the focal length when the object and image distances are known.

Type the distance only. The object is on the left, so u is taken as negative.
Type the size only. The sign is set from the lens/mirror type.
Object stands upright on the principal axis

New Cartesian sign convention (NCERT)

  • The object is always placed to the left of the lens or mirror, so light falls on it from left to right.
  • All distances are measured from the optical centre O of the lens, or from the pole P of the mirror.
  • Distances measured in the direction of the incident light (to the right) are positive. Distances measured against it (to the left) are negative. So the object distance u is always negative for a real object.
  • Heights above the principal axis are positive and heights below it are negative.

With this convention, a convex lens has a positive focal length and a concave lens a negative one. A concave mirror has a negative focal length (its focus is in front of the mirror, on the left) and a convex mirror a positive one (its focus is behind the mirror). The calculator sets these signs for you, so you type only the sizes.

The formulas

Lens formula: 1/v − 1/u = 1/f   and   magnification m = h′/h = v/u

Mirror formula: 1/v + 1/u = 1/f   and   magnification m = h′/h = −v/u

For a spherical mirror, the focal length is half the radius of curvature: f = R/2. For a lens, the power is P = 1/f with f in metres, measured in dioptre (D). A convex lens has positive power and a concave lens negative power.

How to read the answer

  • Sign of v: for a lens, v positive means a real image on the other side; v negative means a virtual image on the same side as the object. For a mirror, v negative means a real image in front of the mirror; v positive means a virtual image behind it.
  • Sign of m: m negative means the image is inverted (and real); m positive means it is erect (and virtual).
  • Size of m: more than 1 means enlarged, less than 1 diminished, exactly 1 the same size.

Worked example

Question: An object 2 cm high is placed 30 cm in front of a convex lens of focal length 10 cm. Find the position, size and nature of the image.

  1. Signs: u = −30 cm, f = +10 cm, h = +2 cm.
  2. Lens formula: 1/v = 1/f + 1/u = 1/10 + 1/(−30) = 3/30 − 1/30 = 2/30 = 1/15, so v = +15 cm.
  3. Magnification: m = v/u = 15 ÷ (−30) = −0.5.
  4. Image height: h′ = m × h = −0.5 × 2 = −1 cm.
  5. The image is 15 cm on the other side of the lens, between F2 and 2F2. It is real (v positive), inverted (m negative) and diminished (half the size of the object).

The calculator shows exactly these values for the example already filled in, and its ray diagram shows the three standard rays meeting at the image.

A few more results you can check with the calculator (f = 15 cm in each case): a concave mirror with the object at 40 cm gives v = −24 cm and m = −0.6; with the object at 10 cm it gives v = +30 cm and m = +3 (virtual, erect, enlarged, as in a shaving mirror). A convex mirror with the object at 20 cm gives v = +8.57 cm and m = +0.43. A concave lens with the object at 30 cm gives v = −10 cm and m = +0.33.

Common mistakes

  • Putting u as positive. For a real object placed on the left, u is always negative.
  • Using the wrong sign for f: concave mirror and concave lens are negative, convex lens and convex mirror are positive.
  • Mixing up the two formulas. The lens formula has a minus sign (1/v − 1/u) and the mirror formula a plus sign (1/v + 1/u).
  • Forgetting the minus sign in the mirror magnification m = −v/u.
  • Forgetting to change f to metres before finding the power of a lens: f = 25 cm gives P = 1/0.25 = +4 D, not 1/25.

Practise with

The formulas assume thin lenses, small mirrors and rays close to the principal axis, as in the NCERT books. Values are shown to 6 significant figures.