Download and extract the reader ZIP archive (a compressed collection of files). Links labelled “reader ZIP; extract …” download this archive; after extraction, open the named file. It includes the offline article, full-size PNG images, editable SVG diagrams, complete source code, tests and worksheets.
Turn an ideal flat mirror by ten degrees while keeping the incoming ray direction fixed. In the two-dimensional geometry used here, the reflected direction turns by twenty degrees. That doubled angle does not guarantee a visible spot on a screen: the ray can miss its width, run parallel to it, or point away.
Specular reflection is the directional reflection modeled for a smooth surface. A surface normal is a direction perpendicular to that surface. A ray is an ideal direction of travel represented by a line with an arrow. A screen intersection is a geometric meeting between a forward ray and a specified line; it is not automatically an illuminated physical spot.
Outcome: derive the signed doubled-angle relation, trace the forward ray to a finite screen, and refuse geometries with no unique valid spot. This is a paper and offline-vector experiment. No laser, optical power, real alignment or measured intensity is involved.
Materials and coordinate choices
Use paper, a ruler, a protractor if available, a text editor, Python and the reader files. No optical hardware is required. The analyzer uses the Python standard library. Actual host execution used CPython 3.9.6 (CPython is the reference implementation of Python); that unsupported historical runtime records what ran, not a recommended deployment environment. The paper geometry is the model, and all supplied data are constructed calculations.
Let x point right and y point up. Put the mirror pivot at (0, 0). The incident travel direction is d = (0, −1), downward toward the pivot. The baseline normal points up. Define positive mirror tilt θ as clockwise from that reference. The tilted unit normal is n = (sin θ, cos θ), and a mirror tangent is (cos θ, −sin θ). Angles displayed by the program are degrees; trigonometric functions internally use radians.
The screen model is the line y = L, with L positive, centred at x = 0 and with half-width W. Default L = 1 and W = 2 use arbitrary, consistent model units. The line is a mathematical observation plane, not an opaque barrier: the model ignores interception of the incoming path, diffraction, finite mirror aperture, thickness and occlusion. A physical apparatus would need those questions resolved independently.
assets/mirror-signed-geometry.svg.Derive the doubled direction
The law of reflection equates incidence and reflection angles measured from the normal. Newport’s technical note also explicitly identifies the doubled angular response to mirror rotation. We can derive the signed result directly with vectors instead of relying on the drawing’s appearance.
r = d − 2(d · n)n unit d and n
= (sin(2θ), cos(2θ)) for d = (0, −1)
clockwise reflected angle from up = atan2(r_x, r_y)
= 2θ modulo a full turn
x at y = L = L r_x / r_y = L tan(2θ)
only when the forward ray reaches that screen line
The dot product d · n is the normal component of travel. Subtracting twice that component reverses it while preserving the tangential component. Reversing the sign of the normal itself leaves the result unchanged. The code normalizes both input directions, so vector length does not secretly change the reflection.
Principal angles are wrapped to [−180°, 180°). For example, θ = 100° gives a reflected principal angle of −160°, equivalent to 200°. Therefore a numerical difference across the wrap boundary is not a giant physical jump. The factor two describes the local continuous direction change with fixed incidence; treating principal-angle subtraction as unwrapped motion would be a mistake.
Run the control, fault and restoration sequence
- Sketch the baseline mirror, incoming travel arrow and up normal. Predict the results for θ = 0°, +10° and −10° in
data/blank-observations.csv. - Run
python3 -m unittest discover -s code -v, thenpython3 code/mirror_lab.py --output my-run. Read the constructed 201-row sweep insweep.csvand the explicit status values insweep.json. - At zero tilt the reflected ray points up and meets the screen centre. At +10° the reflected angle is +20° clockwise and x = 0.3639702343 model unit. At −10° the hit is the equal negative value.
- Inject the common factor-of-two fault by predicting x = L tan θ instead of L tan(2θ). Compare the calculation. Restore the correct vector reflection rather than adjusting the screen to disguise the fault.
- Inspect +40°: the forward infinite-line intersection exists, but lies outside W = 2, so
pointis null and status isoutside_extent. At +45° the ray is parallel to the screen. At +50° the screen lies behind the ray, so status isnot_forward. - Restore θ = 0°. Repeat with a negative tilt and verify sign symmetry. Run
python3 code/mirror_lab.py --output bad-run --distance nan: it must fail before creating that directory.

assets/mirror-screen-validity.svg.Exact spot geometry versus a small-angle approximation
A small-angle approximation replaces tan α by α when α, in radians, is sufficiently close to zero for the task. Here that gives x ≈ 2Lθ. It is a declared approximation, not another exact doubled-angle law. With L = 1, the following values are calculated:
| Mirror θ | Reflected angle | Exact finite-screen result | 2Lθ, radians |
|---|---|---|---|
| 0° | 0° | x = 0 | 0 |
| 5° | 10° | x = 0.176327 | 0.174533 |
| 10° | 20° | x = 0.363970 | 0.349066 |
| 20° | 40° | x = 0.839100 | 0.698132 |
| 30° | 60° | x = 1.732051 | 1.047198 |
| 40° | 80° | Outside width; no spot | 1.396263 |
| 45° | 90° | Parallel; no spot | 1.570796 |
| 50° | 100° | Not forward; no spot | 1.745329 |
The approximation still returns a finite number at 45° and 50°. That number must not be promoted to an observed or valid exact spot. For this particular screen width, the hit boundary is |θ| = arctan(2)/2 ≈ 31.717°. The plotted exact curve ends there; invalid regions are not joined across with invented spot values.
General intersection checks and evidence
The general intersection routine accepts a ray origin and direction, a point and normal defining a screen line, and an optional finite half-extent. The screen is a mathematical observation plane: an opaque physical screen that blocked the incoming path is not part of this model. It checks for a parallel direction, a coincident line with no unique intersection, a non-forward distance parameter, a numerical-range failure and a finite-width miss. A mathematical infinite-line intersection can be retained separately for diagnosis, but the spot field stays null on a miss. The numerical epsilon of 10−12 is a computational guard in the stated model units; it is not a physical resolution or alignment tolerance.
Actual host execution passed 18 tests. A rational check uses n = (3/5, 4/5) and the downward incident ray, giving r = (24/25, 7/25) and an infinite-screen x of 24/7 at y = 1. Other checks cover length preservation, normal-component reversal, normal-sign invariance, rigid-coordinate rotation, screen translation, wrap, malformed and zero vectors, finite-width boundaries and restoration. These establish the listed ideal calculations, not an optical bench result.
Challenge and worked answer
Can you take x = L tan(2θ) unchanged to a screen that has been rotated, or to a different incoming ray direction? Why can a correct doubled ray angle coexist with no screen spot?
Worked answer
The scalar formula was derived for d = (0, −1), a pivot at the origin and screen y = L. A rotated screen or different incoming direction needs the general reflection and intersection vectors. Even when the direction law is correct, a finite screen can be missed, and an infinite line can be parallel to or behind the forward ray. Direction, intersection and physical visibility are separate claims.
For an optical question about intensity rather than direction, compare the three-polarizer experiment. Neither its ideal fractions nor this geometric spot calculation substitutes for an actual calibrated measurement.
Primary sources and source conditions
- Newport: Approximating Real-World Beam Deflection: Primary manufacturer note explicitly identifies the doubled reflected-ray angle under mirror rotation; no vendor apparatus replicated.
- OpenStax University Physics Volume 3: law of reflection: Law measures incident/reflected angles from the surface normal; figures and prose are not copied.
Sources were checked on November 30, 2026. Figures, calculations, lesson text and experiment code are original work for this lesson. Linked third-party material is not bundled in the reader.
Complete reproducible code and checks
Both complete files below are also supplied as editable reader files. Commands create new local output directories. PNG means Portable Network Graphics; SVG means Scalable Vector Graphics. These original figure formats preserve the constructed diagrams; the explanatory text remains Hypertext Markup Language (HTML).
mirror_lab.py — complete file
"""Ideal 2D reflection and finite-screen geometry; constructed paper experiment."""
import argparse,csv,json,math
from pathlib import Path
EPS=1e-12
def scalar(value,limit=1e12):
if isinstance(value,bool) or not isinstance(value,(int,float)):raise ValueError('expected a finite real number')
try:value=float(value)
except (OverflowError,ValueError):raise ValueError('number outside numerical range')
if not math.isfinite(value) or abs(value)>limit:raise ValueError('number outside numerical range')
return value
def vec(value):
if not isinstance(value,(tuple,list)) or len(value)!=2:raise ValueError('expected a two-component vector')
return tuple(scalar(x) for x in value)
def normalize(value):
x,y=vec(value);norm=math.hypot(x,y)
if norm==0:raise ValueError('zero direction vector')
return x/norm,y/norm
def dot(a,b):return a[0]*b[0]+a[1]*b[1]
def reflect(direction,normal):
d=normalize(direction);n=normalize(normal);projection=dot(d,n)
return d[0]-2*projection*n[0],d[1]-2*projection*n[1]
def wrap(degrees):return (scalar(degrees,2e6)+180)%360-180
def screen_hit(origin,direction,line_point,line_normal,half_extent=None):
o,p=vec(origin),vec(line_point);d,n=normalize(direction),normalize(line_normal)
if half_extent is not None:
half_extent=scalar(half_extent)
if half_extent<=0:raise ValueError('screen half-extent must be positive')
den=dot(d,n);num=dot((p[0]-o[0],p[1]-o[1]),n)
result={'status':None,'point':None,'line_intersection':None,'distance_parameter':None}
if abs(den)<=EPS:
result['status']='coincident_line' if abs(num)<=EPS else 'parallel';return result
t=num/den
if not math.isfinite(t) or abs(t)>1e12:result['status']='numerical_range';return result
result['distance_parameter']=t
if t<=EPS:result['status']='not_forward';return result
hit=(o[0]+t*d[0],o[1]+t*d[1])
if any(not math.isfinite(x) or abs(x)>1e12 for x in hit):result['status']='numerical_range';return result
result['line_intersection']=hit
tangent=(-n[1],n[0]);along=dot((hit[0]-p[0],hit[1]-p[1]),tangent)
if half_extent is not None and abs(along)>half_extent+EPS:result['status']='outside_extent';return result
result['status']='hit';result['point']=hit;return result
def trace(theta,L=1,W=2):
theta=scalar(theta,1e6);L=scalar(L);W=scalar(W)
if L<=0 or W<=0:raise ValueError('positive screen distance and half-width required')
radians=math.radians(wrap(theta));n=(math.sin(radians),math.cos(radians));r=reflect((0,-1),n)
angle=wrap(math.degrees(math.atan2(r[0],r[1])))
return {'theta_clockwise_deg':theta,'normal':n,'reflected_direction':r,'reflected_clockwise_deg':angle,'screen':screen_hit((0,0),r,(0,L),(0,1),W),'small_angle_x':2*L*math.radians(theta),'distance':L,'half_width':W}
def export(output,L=1,W=2):
trace(0,L,W) # validate before creating a directory
rows=[trace(n/2,L,W) for n in range(-100,101)]
result={'kind':'constructed ideal 2D geometry','physical_measurement':False,'laser_used':False,'target_executed':False,'distance':L,'half_width':W,'rows':rows,'epsilon':EPS,'epsilon_scope':'numerical guard, not physical angular or spatial resolution'}
dest=Path(output);dest.mkdir(parents=True,exist_ok=True);(dest/'sweep.json').write_text(json.dumps(result,indent=2)+'\n')
summary={k:v for k,v in result.items() if k!='rows'};summary['rows']=len(rows);(dest/'summary.json').write_text(json.dumps(summary,indent=2)+'\n')
with (dest/'sweep.csv').open('w',newline='') as f:
w=csv.writer(f);w.writerow(['theta_clockwise_deg','ray_clockwise_deg','screen_status','spot_x_or_blank','small_angle_x'])
for r in rows:w.writerow([r['theta_clockwise_deg'],r['reflected_clockwise_deg'],r['screen']['status'],r['screen']['point'][0] if r['screen']['point'] else '',r['small_angle_x']])
return result
def main():
p=argparse.ArgumentParser(description=__doc__);p.add_argument('--output',required=True);p.add_argument('--distance',type=float,default=1);p.add_argument('--half-width',type=float,default=2);args=p.parse_args()
try:r=export(args.output,args.distance,args.half_width)
except (ValueError,OverflowError) as exc:p.error(str(exc))
print(json.dumps({k:v for k,v in r.items() if k!='rows'},sort_keys=True));print('constructed rows:',len(r['rows']))
if __name__=='__main__':main()
test_mirror_lab.py — complete file
import json,math,subprocess,sys,tempfile,unittest
from pathlib import Path
import mirror_lab as m
class MirrorTests(unittest.TestCase):
def assertVec(self,a,b):
for x,y in zip(a,b):self.assertAlmostEqual(x,y,places=12)
def test_zero_tilt_control(self):self.assertIsInstance(m.trace(0),dict);self.assertAlmostEqual(m.trace(0)['screen']['point'][0],0)
def test_known_rational_reflection(self):self.assertVec(m.reflect((0,-1),(.6,.8)),(.96,.28))
def test_rational_screen_intersection(self):self.assertAlmostEqual(m.screen_hit((0,0),(.96,.28),(0,1),(0,1))['point'][0],24/7)
def test_normal_sign_irrelevant(self):self.assertVec(m.reflect((.2,-1),(.6,.8)),m.reflect((.2,-1),(-.6,-.8)))
def test_reflection_preserves_norm_and_reverses_normal_component(self):
for degrees in range(-85,86,5):
n=(math.sin(math.radians(degrees)),math.cos(math.radians(degrees)));r=m.reflect((0,-1),n)
self.assertAlmostEqual(math.hypot(*r),1);self.assertAlmostEqual(sum(x*y for x,y in zip(r,n)),-sum(x*y for x,y in zip((0,-1),n)))
def test_double_angle_with_principal_wrap(self):
for t in [-150,-100,-45,-10,0,10,45,100,150,360]:self.assertAlmostEqual(m.trace(t)['reflected_clockwise_deg'],m.wrap(2*t),places=10)
def test_signed_symmetry(self):
for t in [5,10,20,30]:self.assertAlmostEqual(m.trace(-t)['screen']['point'][0],-m.trace(t)['screen']['point'][0])
def test_validity_boundaries(self):
self.assertEqual(m.trace(40)['screen']['status'],'outside_extent');self.assertIsNone(m.trace(40)['screen']['point']);self.assertEqual(m.trace(45)['screen']['status'],'parallel');self.assertEqual(m.trace(50)['screen']['status'],'not_forward')
def test_small_angle_is_not_exact(self):
t=m.trace(10);self.assertAlmostEqual(t['screen']['point'][0],.36397023426620234);self.assertGreater(t['screen']['point'][0],t['small_angle_x'])
def test_zero_or_invalid_vectors(self):
for v in [(0,0),(True,1),(float('nan'),1),(float('inf'),1),(10**500,1),'up',[1]]:
with self.assertRaises(ValueError):m.normalize(v)
def test_invalid_model_scalars(self):
for theta in [True,None,'10',float('nan'),float('inf'),10**500,1e7]:
with self.assertRaises(ValueError):m.trace(theta)
for L,W in [(0,2),(-1,2),(1,-1),(1,True),(1,float('nan'))]:
with self.assertRaises(ValueError):m.trace(0,L,W)
def test_ray_intersection_forward_only(self):
self.assertEqual(m.screen_hit((0,0),(1,0),(0,1),(0,1))['status'],'parallel')
self.assertEqual(m.screen_hit((0,1),(1,0),(0,1),(0,1))['status'],'coincident_line')
self.assertEqual(m.screen_hit((0,2),(0,1),(0,1),(0,1))['status'],'not_forward')
self.assertEqual(m.screen_hit((0,1),(0,1),(0,1),(0,1))['status'],'not_forward')
def test_extent_edge_and_miss(self):
self.assertEqual(m.screen_hit((0,0),(2,1),(0,1),(0,1),2)['status'],'hit')
self.assertEqual(m.screen_hit((0,0),(3,1),(0,1),(0,1),2)['status'],'outside_extent')
def test_rotation_covariance(self):
rot=lambda v:(-v[1],v[0]);d=(.2,-1);n=(.6,.8)
self.assertVec(m.reflect(rot(d),rot(n)),rot(m.reflect(d,n)))
def test_translation_covariance_screen(self):
a=m.screen_hit((0,0),(.2,1),(0,1),(0,1));b=m.screen_hit((3,7),(.2,1),(3,8),(0,1));self.assertVec(b['point'],(a['point'][0]+3,a['point'][1]+7))
def test_tilt_restoration(self):self.assertAlmostEqual(m.trace(0)['screen']['point'][0],m.trace(360)['screen']['point'][0],places=12)
def test_cli_constructed_rows(self):
with tempfile.TemporaryDirectory() as td:
r=subprocess.run([sys.executable,m.__file__,'--output',td],capture_output=True,text=True);self.assertEqual(r.returncode,0,r.stderr);o=json.loads((Path(td)/'summary.json').read_text());self.assertEqual(o['rows'],201);self.assertFalse(o['physical_measurement']);self.assertFalse(o['laser_used'])
def test_cli_rejects_before_writing(self):
with tempfile.TemporaryDirectory() as td:
p=Path(td)/'absent';r=subprocess.run([sys.executable,m.__file__,'--output',str(p),'--distance','nan'],capture_output=True,text=True);self.assertNotEqual(r.returncode,0);self.assertFalse(p.exists())
if __name__=='__main__':unittest.main()
Open the offline reader and reproduction instructions — reader ZIP; extract README.txt. The delivered reader ZIP contains this article, preview, original figures, code, tests and blank and constructed data. The blank worksheet is intentionally empty; generated outputs are explicitly constructed.
