Let
OP be any line through the origin
O which has direction cosines
l,m,n.
Let P be the point having coordinates (x,y,z) and OP=r.
Then OP2=x2+y2+z2=r2...(1)
From P draw PA,PB,PC perpendicular on the coordinate axes, so that OA=x,OB=y,OC=z
Also, ∠POA=α,∠POB=β,∠POC=γ
From triangle AOP,l=cosα=xr⇒x=lr
Similarly, y=mr,z=nr
Adding all we getx2+y2+z2=r2(l2+m2+n2)
⇒r2=r2(l2+m2+n2)
⇒l2+m2+n2=1