<s>[INST] Where is the mistake in a point closest to cross section of two planes and a line problem The problem:
Find the point that lies on the line that is the intersection of two planes:
plane one: $$3x-2y+z = 2$$
plane two: $$x+y+2z = 4$$
The point also  needs to be the same distance away from points $A(1,-1,-1),B(1,-1,3)$
My try:
First I found the direction of the line that is the intersection of two planes. Here I used cross product between $(3,-2,1)$ and $(1,1,2)$, which are the normals of the two planes. I got $s = (-1,-1,1)$ That is the direction of the intersection line.
What I did next was I solved the system of equations: $$3x-2y+z-2 = 0\\x+y+2z-4 = 0$$
I got: $z = 7y +2$ and $x = \frac{-5y}{3}$
Here I chose $y$ to be equal to $1$ $\implies y = 1 \implies x = \frac{-5}{3} \implies z = 9$
So the equation of the intersection line is: $(1,\frac{-5y}{3}, 9) + t(-1,-1,1) = (x,y,z)$
Then I wanted to find the plane where all the points that have the same distance from $A(1,-1,-1),B(1,-1,3)$ are located. it is trivial this plane's normal will be the direction vector $AB$, thus the normal is $n=(0,0,4)$
Then I wanted to position the plane($O$...origin) : $$OA + \frac{1}{2}AB = (1,-1,-1) +\frac{1}{2}(1,-1,3) = (\frac{3}{2},\frac{-3}{2},\frac{1}{2}) = \text{\{This is the point to position the plane\}}$$
So the equation of this plane is: $4z = 4*\frac{1}{2}=2$
I got $z_0$ form the last coordinate from the point.
Then I Solved for intersection between the first line(intersection between plane one and two) and this last plane. I got the wrong answer: $x = \frac{19}{2}, y = \frac{41}{6}, z = \frac{1}{2}$ I got this results by inserting parametrically defined $z$ into the plane equation. My answer is wrong.
The correct solution is: $T(1,1,1)$
Where did I go wrong?
 [/INST] I would have done this a slightly different way.  The two planes are
3x−2y+z=2 and x+y+2z=4.  From the equation of the second plane, x= 4- y- 2z.  Replace x in the first equation by that:  3(4- y- 2z)- 2y+ z= 12- 3y- 6z- 2y+ z= 12- 5y- 5z= 2 so 5y+ 5z= 10 and y+ z= 2 so z= 2- y and x= 4- y- 2(2- y)= 4- y- 4+ 2y= y.
Taking y= t, parametric equations for the line of intersection are x= t, y= t, z= 2- at.  Any point on that line of intersection is of the form (x, y, z)= (t, t, 2- t).
The distance, squared, from A(1, -1, -1) to (t, t, 2- t) is (t- 1)^2+ (t+ 1)^2+ (3- t)^2.
The distance, squared, from B(1, -1, 3) to (t, t, (2- t)) is (t- 1)^2+ (t+ 1)^2+ (1+ t)^2.
For a point on the line equally distant from A an(td B, we must have (t- 1)^2+ (t+ 1)^2+ (3- t)^2= (t- 1)^2+ (t+ 1)^2+ (1+ t)^2.
Those first two squares on the left cancel the first two on the right leaving (3- t)^2= (1+ t)^2.  Taking the square root of both sides 3- t= 1+ t so 2t= 2 and t= 1.  Taking 3- t= -(1+ t)= -1- t does not give a solution.
So the point on the line equidistant from A and B is (t, t, 2- t)= (1, 1, 2- 1)= (1, 1, 1).
Check:  Is (1, 1, 1) on the plane 3x- 2y+ z= 2?  Yes,3- 2+ 1= 2.
Is (1, 1, 1) on the plane x+ 2y+ z= 4?  Yes 1+ 2+ 1= 4.
The distance, squared, from (1, 1, 1) to A(1,-1,- 1) is (1- 1)^2+ (1-(-1))^2+ (1- (-1))^2= 0+ 4+ 4= 8.
The distance, squared, from (1, 1, 1) to B(1, -1, 3) is (1- 1)^2+ (1- (-1))^2+ (1- 3)^2= 0+ 4+ 4= 8.
Yes, (1, 1, 1) is equally distant from A and B.
</s>