# How to grab two points from linear equations and from a matrix m.x == b for the purpose of creating lines or planes from each row.?

Don't get me wrong I can easily do it on paper and I could probably write convoluted code that will get the job done but I feel like there has to be an easy Mathematica way to do this. A few users on here came to my rescue and showed me how to plot linear equations from a matrix but they use ContourPlot and ContourPlot3D. I want to try to do this with other graphing options such as Plot and Plot3D. Below I have a few samples of matrices I wish to create lines and planes from. I think the key here is to find an efficient way to grab two or three points from each matrix row or equation.

    (* line's and plane's from this *)
m3 = {{1, 0, 1}, {-1, 3, 1}, {3, 4, 5}};
b3 = {3, 2, 4};

(* line's from this *)
m2 = {{1, 2}, {3, 1}};
b2 = {1, -2};

(* These are the resulting linear equations and solutions *)

Det[m2]
eqns = m2.{x, y} == b2
Solve[eqns, {x, y}]
Reduce[eqns, {x, y}]

Det[m3]
eqns = m3.{x, y, z} == b3
Solve[eqns, {x, y, z}]
Reduce[eqns, {x, y, z}]


Maybe this way with Hyperplane? Note that the $$i$$-th row of the matrix is a normal vector to the hyperplane defined by the $$i$$-th equation.

m3 = {{1, 0, 1}, {-1, 3, 1}, {3, 4, 5}};
b3 = {3, 2, 4};
p = LinearSolve[m3,b3];

Graphics3D[{
Sphere[p, Scaled[0.02]],
Table[Hyperplane[n, p], {n, m3}]
},
PlotRange -> All
]

• Uh, oh, thank you for telling me. I added it. Jun 16, 2020 at 8:32