At any one moment on a sunny day, the sun's rays strike everything at the same angle. A 1.5 m student casts a 2 m shadow; a nearby tree casts a 12 m shadow. Each object, its shadow and the ray from its top form a right triangle, and those triangles have the same angles, so they are similar. Similar triangles have proportional sides: the tree compares to its shadow exactly as the student compares to theirs.
Set up the proportion with matching sides in matching places: tree shadowtree height=student shadowstudent height, so 12h=21.5. Then h=12×0.75=9 m. At that moment every height is 0.75 times its shadow. A mirror on the ground works the same way: light reflects at equal angles, which creates two similar triangles.
Not every unreachable length needs a second triangle. If you know two sides of a single right triangle, such as a ladder whose foot is 5 ft from a wall and whose top is 12 ft up, the Pythagorean theorem finds the third side directly. And similar triangles give equal ratios, not equal differences: the tree's shadow is 10 m longer than the student's, but the tree is only 7.5 m taller.
Think of it like this. On a sunny afternoon, shadows act like a photocopier stuck on one zoom setting: every object's shadow is the same multiple of its height. Measure that multiple once with something you can reach, such as a metre stick, and undo it for a tree or a flagpole. The trick fails on sloping ground or if the shadows are measured far apart in time.
Core idea. Indirect measurement finds an unreachable length by setting up a proportion from similar figures.