# 3 Equations in 3 Unknowns “The central problem of linear algebra is the solution of simultaneous linear equations. The most important case is when the number of unknowns equals the number of equations… we begin in three dimensions.” Gilbert Strang – Linear Algebra and its Applications

Ax + By + Cz = D is a linear equation which can be represented by a plane. The intersection of 3 planes at a single point is the solution of the 3 equations used to plot the planes.

its hard to show the intersection of 3 planes with a static image. the Region object is trimmable with the command SurfTrim.
this is the very first example set of equations from Strang’s (old version) book. A plane is defined by 3 points. But the equation for the plane is more directly derived from a single point and a vector that is orthogonal (perpendicular) to the plane. The dot product of two vectors is $\mathbf{a} \cdot \mathbf{b} = |\mathbf{a}| |\mathbf{b}| \cos \theta$

so if the angle between the vectors is 90 degrees, the scalar dot product is zero. The dot product also has the alternative computation that if vector a = (a1, a2, a3) and b = (b1, b2, b3) then $\mathbf{a} \cdot \mathbf{b} = (a1 \ast b1) + (a2 \ast b2) + (a3 \ast b3)$

if N is the vector perpendicular to the plane, $\mathbf{N} = \begin {pmatrix} A \\ B \\ C \\ \end{pmatrix}$

if P1 is the specific point in the plane, and P is a generic point in the plane, $\mathbf{P1} = \begin {pmatrix} x1 \\ y1 \\ z1 \\ \end{pmatrix}$ $\mathbf{P} = \begin {pmatrix} x \\ y \\ z \\ \end{pmatrix}$

then a vector from P1 to P is (P – P1) and the dot product of N and this line is zero. $\mathbf{N} \cdot (\mathbf{P} - \mathbf{P1}) = 0$

according to the rules, that can be written as $\mathbf{N} \cdot \mathbf{P} = \mathbf{N} \cdot \mathbf{P1}$

which becomes $Ax + By + Cz = A(x1) + B(y1) + C(z1)$

the numbers on the right have specific values, because we are using a specific point and a specific vector, so we can just call those D $Ax + By + Cz = D$

which is the standard equation for a plane. The constants A B and C are from the normal vector.

In linear algebra, we are usually given 3 of these equations, and asked to solve it, which means find the intersection of the planes, if it exists. To plot from this equation, Ax + By + Cz = D, where A,B,C and D have actual values, to autocad or any other graphic method, we need three points. About the only way to do that i know is to substitute values. In the most general case where neither A, B or C is zero, the plane intersects all 3 axes, and the 3 intersection points can be found by solving the equation with two variables of x, y and z set to zero. Where one variable of A, B, and C is set to zero, the plane is parallel to the missing axis variable. Where two variables are zero the plane is parallel to both. Its a little tedious, but you just set up tables and solve the equation in the abstract with the missing variables visualizing the plane. Then a select case statement will be the gateway to the actual drawing of the plane.

The other method needed – besides plotting given only the standard equation – is deriving the equation from 3 given points. For that the cross product is essential. 3 non-linear points form a triangle, from which you can see 2 vectors in the plane. The cross product of 2 vectors is a third vector that is orthogonal (perpendicular) to both of them. the cross product gives you the normal vector, with ABC direction numbers. Then you use one of the 3 points, the normal vector, and derive the equation.

all this is covered in the latter third of a full calculus book, the chapter on vectors in space, or 3D vectors, or geometry of space. its also in analytic geometry books and implied or explained in linear algebra books. I am making a linear algebra homework tool.

In the most general case where neither A, B, or C is zero, the axis intercepts are calculated, a triangle can be drawn, and it can be filled with a Region object. If D is zero the plane goes thru the origin, and that is also a special case, the 3 intercepts are the same.

If you are given the std equation, you have the normal vector, but if you are given the 3 points in the plane, you need the normal vector. That is a pretty simple operation with the cross product. the cross product is a pretty fussy formula, but once it is captured to a sub its easy to use.

    Function find_norm(ptA() As Double, ptB() As Double, ptC() As Double) As Double()
'given 3 points, not co-linear, find norm
Dim AB() As Double
Dim AC() As Double
Dim norm() As Double

AB = Minusv(ptB, ptA)
AC = Minusv(ptC, ptA)
norm = Cross_Product(AB, AC)

Return norm
End Function

Function Cross_Product(t() As Double, v() As Double) As Double()
Dim x, y, z As Double
x = t(1) * v(2) - t(2) * v(1)
y = t(2) * v(0) - t(0) * v(2)
z = t(0) * v(1) - t(1) * v(0)
Cross_Product = Pt(x, y, z)

Return Cross_Product
End Function


now having 3 points and a normal vector, its optional, but i find the centroid of the triangle as a convenient reference point. if the vertexes are F, G, H, the centroid is very simply (F + G + H) / 3. Now using a vector from the centroid to a vertex, and having the normal, you can once again use the cross product to find a vector orthogonal to both of them. For the purpose of creating a UCS (User Coordinate System) in the plane. Once you have created the UCS, its a simple matter to enlarge your plane, using a Circle center at the centroid, or a square or rectangle.

its a work in progress, here is current state of form. its not really easy to pick off the intersections graphically. the regions can be trimmed but i am going to look at other objects and methods. 