# Thin lens, mirror and Snell's law calculator

> Thin lens and mirror equation for image distance, object distance or focal length, with magnification; Snell's law refraction and critical angle.

النسخة التفاعلية: https://www.calcopenly.com/ar/science/optics-lens-snell-calculator
الموضوع: حاسبات العلوم

The thin-lens equation, 1/f = 1/dₒ + 1/dᵢ, links the focal length f, the object distance dₒ and the image distance dᵢ, and the same equation holds for spherical mirrors. Give any two and the calculator solves the third, then finds the magnification m = −dᵢ/dₒ, the image height, whether the image is real or virtual, and the power in dioptres (1/f with f in metres). Snell's law, n₁ sin θ₁ = n₂ sin θ₂, gives the refracted angle at a boundary and the critical angle beyond which light is totally reflected.

With the defaults, a converging lens of f = 10 cm and an object 30 cm away, the image forms 15 cm behind the lens, inverted and half size (m = −0.5), the arrangement in a camera. Light passing from air into water at 45° bends to 32.05°.

Signs follow the real-is-positive convention: virtual images have negative dᵢ, and diverging lenses and convex mirrors have negative f. Lenses are thin, so thickness and aberrations are ignored.

## المدخلات

- **Calculate** (الخيارات: Lens or mirror, Snell's law)
- **Element** (الخيارات: Converging lens, Diverging lens, Concave mirror, Convex mirror)
- **Solve for** (الخيارات: Image distance, Object distance, Focal length)
- **Focal length (size, without sign)**
- **Object distance**
- **Image distance (negative if virtual)**
- **Object height**
- **Show distances in** (الخيارات: cm, mm, m, in)
- **Refractive index of medium 1 (incident)**
- **Refractive index of medium 2**
- **Angle of incidence (from the normal)**

## النتائج

- Image distance (cm) — النتيجة الرئيسية
- Object distance (cm)
- Focal length (signed) (cm)
- Magnification
- Image height (negative = inverted) (cm)
- Image
- Optical power (D)
- Angle of refraction (°)
- Critical angle (°)
- Total internal reflection
- Deviation of the ray (°)

## الصيغة

$$
\frac1f = \frac1{d_o} + \frac1{d_i},\quad m = -\frac{d_i}{d_o};\qquad n_1\sin\theta_1 = n_2\sin\theta_2,\quad \theta_c = \arcsin\frac{n_2}{n_1}
$$

## أمثلة محلولة

### Converging lens f = 10 cm, object at 30 cm

- Calculate: Lens or mirror
- Element: Converging lens
- Solve for: Image distance
- Focal length (size, without sign): 10 cm
- Object distance: 30 cm
- Show distances in: cm
- **Image distance: 15 cm**
- **Magnification: -0.5**
- **Image: Real, inverted, reduced**
- **Optical power: 10 D**
- مصدر التحقق: ⁨Python 3.8 fractions: 1/dᵢ = 1/10 − 1/30 ⇒ dᵢ = 15 cm, m = −½; P = 1/0.1 m⁩

### Object inside the focal length: magnifying glass

- Calculate: Lens or mirror
- Element: Converging lens
- Solve for: Image distance
- Focal length (size, without sign): 10 cm
- Object distance: 5 cm
- Show distances in: cm
- **Image distance: -10 cm**
- **Magnification: 2**
- **Image: Virtual, upright, magnified**
- مصدر التحقق: ⁨Python 3.8 fractions: 1/dᵢ = 1/10 − 1/5 = −1/10 ⇒ dᵢ = −10 cm⁩

### Diverging lens f = 10 cm, object at 20 cm

- Calculate: Lens or mirror
- Element: Diverging lens
- Solve for: Image distance
- Focal length (size, without sign): 10 cm
- Object distance: 20 cm
- Show distances in: cm
- **Image distance: -6.66667 cm**
- **Magnification: 0.333333**
- **Image: Virtual, upright, reduced**
- مصدر التحقق: ⁨Python 3.8 fractions: 1/dᵢ = −1/10 − 1/20 = −3/20 ⇒ dᵢ = −20/3 cm⁩

### Concave mirror at 2f: same size

- Calculate: Lens or mirror
- Element: Concave mirror
- Solve for: Image distance
- Focal length (size, without sign): 10 cm
- Object distance: 20 cm
- Show distances in: cm
- **Image distance: 20 cm**
- **Magnification: -1**
- **Image: Real, inverted, same size**
- مصدر التحقق: ⁨Python 3.8 fractions: 1/dᵢ = 1/10 − 1/20 ⇒ dᵢ = 20 cm, m = −1 (OpenStax UP3 §2.3)⁩

### Focal length from the two distances

- Calculate: Lens or mirror
- Element: Converging lens
- Solve for: Focal length
- Object distance: 30 cm
- Image distance (negative if virtual): 15 cm
- Show distances in: cm
- **Focal length (signed): 10 cm**
- مصدر التحقق: ⁨Python 3.8 fractions: 1/f = 1/30 + 1/15 ⇒ 10 cm⁩

### Air into water at 45°

- Calculate: Snell's law
- Refractive index of medium 1 (incident): 1.000293
- Refractive index of medium 2: 1.333
- Angle of incidence (from the normal): 45 °
- **Angle of refraction: 32.0472 °**
- **Total internal reflection: No**
- مصدر التحقق: ⁨Python 3.8 math: asin(1.000293 sin45°/1.333) = 32.04723°⁩

## الأسئلة

### What is the thin lens equation?

1/f = 1/dₒ + 1/dᵢ, where f is the focal length, dₒ the object distance and dᵢ the image distance, all measured from the lens. For f = 10 cm and an object at 30 cm, 1/dᵢ = 1/10 − 1/30, so dᵢ = 15 cm. A negative dᵢ means a virtual image on the same side as the object, as seen through a magnifying glass.

### How do you calculate the magnification of a lens?

m = −dᵢ/dₒ, and the image height is m times the object height. A negative m means the image is inverted; |m| above 1 means it is enlarged. An object 5 cm from a 10 cm magnifying glass gives dᵢ = −10 cm and m = +2, an upright virtual image twice the size. At dₒ = 2f the image is real, inverted and the same size (m = −1).

### What is the critical angle for total internal reflection?

θc = arcsin(n₂/n₁), which exists only when light heads into a medium with a lower index (n₁ > n₂). Into air it is 41.8° from glass (n = 1.5), 48.6° from water (1.333) and 24.4° from diamond (2.417), which is why cut diamonds sparkle. A ray meeting the surface at more than θc from the normal is reflected completely, the principle behind optical fibre.

### What is Snell's law?

n₁ sin θ₁ = n₂ sin θ₂: the refractive index times the sine of the angle from the normal is the same on both sides of a boundary. Light entering water (n = 1.333) from air at 45° continues at 32.0°, bent towards the normal because water has the higher index. Going the other way the ray bends away from the normal, and beyond the critical angle it cannot leave at all.

### What is lens power in dioptres?

Power P = 1/f with f in metres, measured in dioptres (D). A converging lens with f = 10 cm has P = +10 D, and a diverging lens with f = −50 cm has −2 D. Spectacle prescriptions use this unit: short sight is corrected with negative (diverging) lenses and long sight with positive ones, and the powers of thin lenses in contact add.

### ما مدى دقة «⁨Thin lens, mirror and Snell's law calculator⁩»؟

تعتمد الدقة على مدخلاتك وافتراضات الطريقة. يستخدم الحساب العشري 50 رقمًا معنويًا، لكن التقديرات والأساليب العددية وبيانات المصدر قد تكون أقل دقة؛ تقريب القيم المعروضة لا يزيل هذه الحدود. أمثلة محلولة جرى التحقق منها بمصادر مستقلة: 8. مثلًا، يجري التحقق من «⁨Converging lens f = 10 cm, object at 30 cm⁩» بالرجوع إلى ⁨Python 3.8 fractions: 1/dᵢ = 1/10 − 1/30 ⇒ dᵢ = 15 cm, m = −½; P = 1/0.1 m⁩.

### ما مصدر هذه الطريقة؟

OpenStax University Physics Volume 3, §2.3 Spherical mirrors and §2.4 Thin lenses; OpenStax University Physics Volume 3, §1.4 Refraction and §1.5 Total internal reflection; Hecht, Optics (5th ed.), Table 4.1 — refractive indices.

## المصادر

- [OpenStax University Physics Volume 3, §2.3 Spherical mirrors and §2.4 Thin lenses](https://openstax.org/books/university-physics-volume-3/pages/2-4-thin-lenses)
- [OpenStax University Physics Volume 3, §1.4 Refraction and §1.5 Total internal reflection](https://openstax.org/books/university-physics-volume-3/pages/1-5-total-internal-reflection)
- Hecht, Optics (5th ed.), Table 4.1 — refractive indices
