0
$\begingroup$

Find the equation of the line passing through the point (2,1,3) and perpendicular to the line (x + 1)/3 == (y - 1)/2 == z/-1 and having an intersection point.

Clear["Global`*"];
s1 = {s11, s12, s13};
s2 = {3, 2, -1};
Solve[{(x0 - 2)/s11 == (y0 - 1)/s12 == (z0 - 3)/s13, (x0 + 1)/3 == (
   y0 - 1)/2 == z0/-1, s1.s2 == 0}, {x0, y0, z0, s11, s12, s13}]

(*{{x0 -> 2/7, y0 -> 13/7, z0 -> -(3/7), s11 -> -2 s12, s13 -> -4 s12}}*)

Then,

Assuming[s11 == -2 s12 && s13 == -4 s12 && s12 != 0 && 
  s12 \[Element] Reals, 
 Refine[(x - 2)/s11 == (y - 1)/s12 == (z - 3)/s13]]

(*(-2 + x)/s11 == (-1 + y)/s12 == (-3 + z)/s13*)

However, obviously, the equation of the line is:

(-2 + x)/-2 == (-1 + y)/1 == (-3 + z)/-4

How to get this result?

$\endgroup$
10
  • $\begingroup$ Please clarify the "definition of a line" (x + 1)/3 == (y - 1)/2 == z/-1 !Onedimensional line should depend on one parameter. $\endgroup$ Feb 14, 2022 at 11:24
  • $\begingroup$ That is the equation of a plane $\endgroup$
    – Drod
    Feb 14, 2022 at 11:35
  • $\begingroup$ @UlrichNeumann Solve[(x + 1)/3 == (y - 1)/2 == z/-1 == t, {x, y, z}] $\endgroup$
    – cvgmt
    Feb 14, 2022 at 11:42
  • $\begingroup$ @Drod There are two equations in (x + 1)/3 == (y - 1)/2 == z/-1 so it is a line. $\endgroup$
    – cvgmt
    Feb 14, 2022 at 11:44
  • $\begingroup$ There isn't just one equation describing the line - you could multiply all three parts by a constant. Perhaps this is why refine isn't choosing your particular denominators. $\endgroup$
    – flinty
    Feb 14, 2022 at 11:48

1 Answer 1

1
$\begingroup$

The condition in your code

s11 == -2 s12 && s13 == -4 s12 && s12 != 0 && s12 \[Element] Reals

gives non-unique solution. In fact, the first Solve already indicates that the number of equations is insufficient to provide unique solution (5 eqs and 6 vars). You could simply use FindInstance on {s11,s12,s13}

FindInstance[ s11 == -2 s12 && s13 == -4 s12 && s12 != 0 && s12 \[Element] Reals, {s11, s12, s13}]

(*{{s11 -> 2, s12 -> -1, s13 -> 4}}*)

and plug this instance right into the equality. If you want it to be more consistent, try the following:

line = (x + 1)/3 == (y - 1)/2 == z/-1;
v = {3, 2, -1} (*line vector*);
p0 = {2, 1, 3} (*point on the other line*);
surf = ({x, y, z} - p0) . v == 0 (*equation of surface that contains p0 and has v as normal*);

(*intersection point of line and surf*)
P = {x, y, z} /. First@Solve[line && surf, {x, y, z}];
(*line equation*)
Eliminate[({x, y, z} - p0) == t*(P - p0), t]

(*x == -2 (-2 + y) && 4 y == 7 - z*)

If you rather prefer the three equality format,

(*terms in line equation, treated coordinate-wise*)
eqs = Flatten@(t /. Solve[#, t] & /@ Table[({x, y, z} - p0)[[i]] == t*(P - p0)[[i]], {i, 3}]);
(*common factor*)
lcm = PolynomialLCM @@ Coefficient[eqs, {x,y,z}];
(*output*)
eqs/lcm /. {x_, y_, z_} -> (x == y == z)

(*(2 - x)/2 == -1 + y == (3 - z)/4*)
$\endgroup$
1
  • $\begingroup$ The answer is very good, thank you! @Shin Kim $\endgroup$
    – lotus2019
    Feb 15, 2022 at 6:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.