Given: P(2,2,1)≡(x1,y1,z1) and Q(5,1,-2)≡(x2,y2,z2)
Let the point on the line joining P and Q (x,y,z) divides it in the ratio of m:1
then x = (mx2+x1)/(m+1) ⇒ 4 = (m×5+2)/(m+1) ⇒ 4m+4 = 5m+2 ⇒ m=2
z-coordinate is: z = (mz2+z1)/(m+1) ⇒ z = (2×(-2)+1)/(2+1) = -3/3 = -1
z = -1