Introduction to Cartesian Geometry

Welcome to Introduction to Cartesian Geometry

In Cartesian or Analytic Geometry we will learn how to represent points, lines, and planes using the Cartesian Coordinate System, also called Rectangular Coordinate System. This can be applied to solve a broad range of problems from geometry to algebra and it will be very useful later on Calculus.

=Cartesian Coordinate System=

The foundations of Analytic Geometry lie in the search for describing geometric shapes by using algebraic equations. One of the most important mathematicians that helped to accomplish this task was René Descartes for whom the name is given to this exciting subject of mathematics.

The Coordinate System
For a coordinate system to be useful we want to give to each point an attribute that helps to distinguish and relate different points. In the Cartesian system we do that by describing a point using the intersection of two(2D Coordinates) or more(Higher Dimensional Coordinates) lines. Therefore a point is represented as P(x1,x2,x3,...,xn) in "n" dimensions.

2D Coordinates
You can look at a 2D Coordinate system as a system in which a point can be defined using two values. We do this by using two perpendicular and directed lines called the abscissa(x-axis) and the ordinate(y-axis). The point of intersection of these two lines is called the origin denoted O(0,0). Any point can be determined as P(x,y), where x is the value in the x-axis and y is the value in the y-axis.



=3d Coordinate Geometry=

The coordinate system in two dimensions uses values containing width and depth expressed as values of $$X$$ and/or $$Y.$$

Coordinate geometry in three dimensions adds the dimension of height, usually expressed as a value of $$Z.$$ The axes of $$X$$ and $$Y$$ usually represent the horizontal plane. The $$Z$$ axis is thus vertical or normal to the plane of $$X$$ and $$Y.$$

In three dimensional space a point is shown as $$(x_1, y_1, z_1)$$ where the 3 values locate the point relative to the origin along each of the $$X, Y, Z$$ axes respectively. The value $$(0, 0, 0)$$ is valid, usually the origin.

Within this page the values $$x_1, y_1, z_1$$ are all real numbers.

Examples of points in 3 dimensional space.
Points of 1 dimension

Each of the points in the diagram has exactly one dimension.

The point $$(10,\ 0,\ 0)$$ has only the dimension of width. It is on the $$X$$ axis.

The point $$(0,\ 12,\ 0)$$ has only the dimension of depth. It is on the $$Y$$ axis.

The point $$(0,\ 0,\ 13)$$ has only the dimension of height. It is on the $$Z$$ axis.

$$$$$$$$$$$$$$$$

Points of 2 dimensions

Each of the points in the diagram has exactly two dimensions.

The point $$(8,\ 6,\ 0)$$ has the dimensions of width and depth, no height.

The point $$(0,\ 12,\ 6)$$ has the dimensions of depth and height, no width.

The point $$11,\ 0,\ -7)$$ has the dimensions of width and height, no depth.

Points of 3 dimensions

Each of the points in the diagram has three dimensions.

Distance between 2 points


Consider the point $$Q\ (4, 3, 12).$$ What is the distance from point $$Q$$ to the origin?

Point $$P$$ is the projection of $$Q$$ on to the plane of $$X,Y.$$

Calculate length $$OP = \sqrt{4^2 + 3^2 }.$$

Then length $$OQ = \sqrt{(OP)^2 + 12^2 } = \sqrt{4^2 + 3^2 + 12^2 } = \sqrt{169} = 13.$$

Length $$OQ = \sqrt{x_1^2 + y_1^2 + z_1^2}.$$ In this case $$(x_1, y_1, z_1) = (4, 3, 12).$$

The general case:

For two points $$M\ (x_M, y_M, z_M)$$ and $$N\ (x_N, y_N, z_N)$$

the distance $$MN = \sqrt{(x_M - x_N)^2 + (y_M - y_N)^2 + (z_M - z_N)^2 }.$$

Length $$OQ$$ is the special case in which $$(x_N, y_N, z_N) = (0, 0, 0).$$

The distance $$MN$$ may be $$0$$ in which case $$M$$ and $$N$$ are the same point.

as 2 points
In the example above line $$OP$$ passes through the points $$O\ (0,0,0)$$ and $$P\ (4,3,0).$$

The line $$OP$$ may be defined by the two points $$O$$ and $$P$$ provided that the length $$OP$$ is non-zero.

Line $$OP = (O, P) = ((0,0,0),\ (4,3,0))$$

There are other ways to define a line. Add a descriptor to avoid confusion:

Line $$OP = (O, P) = ((0,0,0),\ (4,3,0),$$ '$$2$$points'$$)$$ where:

$$(x_O, y_O, z_O) = (0,0,0)$$ and $$(x_P, y_P, z_P) = (4,3,0).$$

Line $$PO = (P, O) = ((4,3,0),\ (0,0,0),$$ '$$2$$points'$$).$$

Similarly:

line $$PQ = (P, Q) = ((4,3,0),\ (4,3,12),$$ '$$2$$points'$$)$$

line $$QP = (Q, P) = ((4,3,12),\ (4,3,0),$$ '$$2$$points'$$)$$

line $$OQ = (O, Q) = ((0,0,0),\ (4,3,12),$$ '$$2$$points'$$)$$ and

line $$QO = (Q, O) = ((4,3,12),\ (0,0,0),$$ '$$2$$points'$$).$$

as point and 3 direction numbers
For information about direction numbers see Line_(Geometry).

Line $$OQ$$ above is defined by 2 points $$O\ (x_1,y_1,z_1)=(0,0,0)$$ and $$Q\ (x_2,y_2,z_2)=(4,3,12).$$

The direction numbers of line $$OQ = [A,B,C] = [x_2-x_1,y_2-y_1,z_2-z_1] = [4,3,12].$$

A line may be defined as $$((x_1,y_1,z_1),\ [A_1,B_1,C_1])$$ where:

$$(x_1,y_1,z_1)$$ is a known point on the line, and

$$[A_1,B_1,C_1]$$ are the direction numbers of the line.

In practice:

The programming language python, for example, recognizes  as a list and code can interpret these values as direction numbers.

Python recognizes  as a tuple and code can interpret these values as coordinates of a point.

In python a line may be defined as:


 * or



Line $$OQ$$ may be defined as $$((0,0,0), (4,3,12),$$ 'p&dn'$$).$$

Given a point on the line and the direction numbers of the line, any other point on the line may be established by introducing constant $$K.$$

On line $$((x_1,y_1,z_1),\ (A_1,B_1,C_1),$$ 'p&dn'$$)$$ any second point $$(x_2,y_2,z_2) = (x_1+KA_1, y_1+KB_1, z_1+KC_1)$$ and distance from $$(x_1,y_1,z_1)$$ to $$(x_2,y_2,z_2)$$

$$= \sqrt{(x_2-x_1)^2 + (y_2-y_1)^2 + (z_2-z_1)^2}$$

$$= \sqrt{(x_1+KA_1-x_1)^2 + (x_2+KB_1-y_1)^2 + (z_1+KC_1-z_1)^2}$$

$$= \sqrt{(KA_1)^2 + (KB_1)^2 + (KC_1)^2}$$

$$= K\sqrt{A_1^2 + B_1^2 + C_1^2}$$

It would be convenient if the value $$A_1^2 + B_1^2 + C_1^2$$ would $$= 1.$$

If $$A_1^2 + B_1^2 + C_1^2 == 1,$$ the values $$A_1, B_1, C_1$$ are the direction cosines of the line.

To convert direction numbers to direction cosines divide each direction number by $$\sqrt{A_1^2 + B_1^2 + C_1^2}.$$

$$(\frac{A_1}{\sqrt{A_1^2 + B_1^2 + C_1^2} })^2 + ( \frac{B_1}{\sqrt{A_1^2 + B_1^2 + C_1^2} }     )^2 + (  \frac{C_1}{\sqrt{A_1^2 + B_1^2 + C_1^2} }   )^2$$

$$= \frac{A_1^2}{A_1^2 + B_1^2 + C_1^2} + \frac{B_1^2}{A_1^2 + B_1^2 + C_1^2} + \frac{C_1^2}{A_1^2 + B_1^2 + C_1^2}$$

$$= \frac{A_1^2 + B_1^2 + C_1^2}{A_1^2 + B_1^2 + C_1^2} = 1.$$

If $$[A,B,C]$$ are the direction cosines of the line, any second point on the line exactly $$K$$ units from $$(x_1, y_1, z_1)$$ has coordinates $$(x_1 + KA, y_1+KB, z_1+KC).$$

While point $$(0,0,0)$$ is valid, direction numbers $$[A,B,C]=[0,0,0]$$ are not valid. For the group of direction numbers to be valid, at least one of $$A,B,C$$ must be non-zero.

Angle between two lines
In the diagram line $$OM$$ has direction numbers $$[A_1,B_1,C_1].$$ Point $$M$$ has coordinates $$(A_1,B_1,C_1).$$

Line $$ON$$ has direction numbers $$[A_2,B_2,C_2]$$ and point $$N$$ has coordinates $$(A_2,B_2,C_2).$$

Length $$OM = \sqrt{A_1^2 + B_1^2 + C_1^2}.$$

Length $$ON = \sqrt{A_2^2 + B_2^2 + C_2^2}.$$

Length $$MN = \sqrt{(A_1-A_2)^2 + (B_1-B_2)^2 + (C_1-C_2)^2}.$$

By the cosine rule $$MN^2 = ON^2 + OM^2 - 2\cdot OM\cdot ON\cdot\cos(\theta).$$

$$\cos(\theta) = \frac{MN^2 - ON^2 - OM^2}{- 2\cdot OM\cdot ON} = \frac{ON^2 + OM^2 - MN^2}{2\cdot OM\cdot ON}$$ $$= \frac{A_1\cdot A_2 + B_1\cdot B_2 + C_1\cdot C_2}{ \sqrt{A_1^2 + B_1^2 + C_1^2} \cdot \sqrt{A_2^2 + B_2^2 + C_2^2} }$$

If all values are direction cosines, $$\cos(\theta) = A_1\cdot A_2 + B_1\cdot B_2 + C_1\cdot C_2.$$

If $$\cos(\theta) == 0,$$ the lines are normal.

If $$\cos(\theta) == 1$$ or $$\cos(\theta) == -1,$$ the lines are parallel.

Angle between line and each axis:

Let a line have direction cosines $$[A_1,B_1,C_1].$$

Let $$X$$ axis have direction cosines $$[A_2,B_2,C_2] = [1,0,0].$$

Let $$\theta_X$$ be angle between line and $$X$$ axis.

$$\cos(\theta_X) = A_1\cdot 1 + B_1\cdot 0 + C_1\cdot 0 = A_1.$$

Hence the expression direction cosine. $$A_1$$ is the cosine of the angle between line and $$X$$ axis.

Similarly $$B_1$$ is cosine of angle between line and $$Y$$ axis and $$C_1$$ is cosine of angle between line and $$Z$$ axis.

Parallel lines:

Let one line have direction numbers $$[A,B,C]$$ and a second line have $$[KA,KB,KC].$$

$$\cos(\theta)$$ $$= \frac{A_1\cdot A_2 + B_1\cdot B_2 + C_1\cdot C_2}{ \sqrt{A_1^2 + B_1^2 + C_1^2} \cdot \sqrt{A_2^2 + B_2^2 + C_2^2} }$$ $$= \frac{A\cdot KA + B\cdot KB + C\cdot KC}{ \sqrt{A^2 + B^2 + C^2} \cdot K\sqrt{A^2 + B^2 + C^2} }$$ $$= \frac{K(A^2 + B^2 + C^2)}{ K(A^2 + B^2 + C^2 ) } = 1.$$

$$\theta = 0^\circ$$ and the lines are parallel.

Similarly, if the second line has direction numbers $$[-KA,-KB,-KC],\ \cos(\theta) = -1,\ \theta = 180^\circ$$ and the lines are parallel.

To verify that two lines are not parallel, check that $$|\cos(\theta)|$$ does not equal $$1.$$

If one line has direction numbers $$[A_1,B_1,C_1]$$ and the second line has direction numbers $$[A_2,B_2,C_2] = [KA_1,KB_1,KC_1]$$ then:

$$\frac{A_2}{A_1} = \frac{B_2}{B_1} = \frac{C_2}{C_1} = K$$

$$A_2B_1 = A_1B_2,\ B_2C_1 = B_1C_2,\ A_2C_1 = A_1C_2$$

The values $$B_1C_2 - C_1B_2,$$ $$C_1A_2 - A_1C_2,$$ $$A_1B_2 - B_1A_2$$ are the direction numbers of the normal to both lines. If the normal to both lines has direction numbers  the lines are parallel.

Normal to 2 lines
A line normal or perpendicular to two lines is normal to each line.

Before attempting to calculate the direction numbers of the normal, first verify that the two lines are not parallel.

Let the normal have direction numbers $$[A_1,B_1,C_1].$$

Let the 2 lines have direction numbers $$[A_2,B_2,C_2],\ [A_3,B_3,C_3].$$

Then:

$$A_1A_2 + B_1B_2 + C_1C_2 = 0\ \dots\ (1)$$ and

$$A_1A_3 + B_1B_3 + C_1C_3 = 0\ \dots\ (2)$$

$$(1)*C_3,\ A_1A_2C_3 + B_1B_2C_3 + C_1C_2C_3 = 0\ \dots\ (3)$$

$$(2)*C_2,\ A_1A_3C_2 + B_1B_3C_2 + C_1C_3C_2 = 0\ \dots\ (4)$$

$$(3)-(4),\ A_1(A_2C_3-A_3C_2) + B_1(B_2C_3 - B_3C_2) = 0\ \dots\ (5)$$

$$\frac{A_1}{B_1} = \frac{B_3C_2-B_2C_3}{A_2C_3-A_3C_2}\ \dots\ (6)$$

If divisor $$A_2C_3-A_3C_2 == 0,$$ $$\frac{B_1}{C_1} = \frac{C_3A_2-C_2A_3}{B_2A_3-B_3A_2}\ \dots\ (7)$$

If divisor $$B_2A_3-B_3A_2 == 0,$$ $$\frac{C_1}{A_1} = \frac{A_3B_2-A_2B_3}{C_2B_3-C_3B_2}\ \dots\ (8)$$

Provided that all inputs are valid, then at least one of $$[A_1,B_1,C_1]$$ must be non-zero and at least one of $$(6)$$ or $$(7)$$ or $$(8)$$ must be valid.

From $$(6), (7), (8)$$ above:

$$\frac{A_1}{B_3C_2 - B_2C_3} = \frac{B_1}{A_2C_3-A_3C_2} = \frac{C_1}{B_2A_3-B_3A_2}$$

Values of $$[A_1,B_1,C_1]$$ that satisfy this condition are:

$$[B_3C_2 - B_2C_3,\ A_2C_3-A_3C_2,\ B_2A_3-B_3A_2].$$

Proof:

Angle between $$[A_1,B_1,C_1]$$ and $$[A_2,B_2,C_2]:$$

$$\cos (\theta) = (B_3C_2 - B_2C_3)A_2 + (A_2C_3-A_3C_2)B_2 + (B_2A_3-B_3A_2)C_2$$ $$= B_3C_2A_2 - B_2C_3A_2 + A_2C_3B_2-A_3C_2B_2 + B_2A_3C_2-B_3A_2C_2$$ $$= B_3C_2A_2 - B_3A_2C_2 + A_2C_3B_2 - B_2C_3A_2 + B_2A_3C_2 - A_3C_2B_2$$ $$= 0$$

Therefore the two groups of direction numbers are normal.

Similarly it can be shown that the two groups of direction numbers $$(A_1,B_1,C_1)$$ and $$(A_3,B_3,C_3)$$ are normal.

The line normal to $$[A_2,B_2,C_2]$$ and $$[A_3,B_3,C_3]$$ has direction numbers:

$$A_1 = B_3C_2 - C_3B_2$$

$$B_1 = C_3A_2 - A_3C_2$$

$$C_1 = A_3B_2 - B_3A_2$$

Parallel input:

Let $$[A_3,B_3,C_3] = [KA_2,KB_2,KC_2]$$

Then $$A_1 = B_3C_2 - C_3B_2 = (KB_2)(C_2) - (KC_2)(B_2) = 0$$

If the two groups of direction numbers $$[A_2,B_2,C_2], [A_3,B_3,C_3]$$ are parallel, $$[A_1,B_1,C_1] = [0,0,0].$$

Normal to 1 line
If a given line has direction numbers then any of the following groups of direction numbers is normal to the given line:

For example:

If the given line has direction numbers arbitrary normals have direction numbers In this case only the groups  are valid.

If the given line has direction numbers arbitrary normals have direction numbers In this case all three groups of direction numbers are valid.

If the given line has direction numbers arbitrary normals have direction numbers In this case all three groups of direction numbers are valid. However, the groups are parallel.

Point and line
In the diagram line $$PQ$$ and point $$M$$ are well defined and $$\theta = \angle MPQ.$$$$$$$$$$

Point $$N$$ is on line $$PQ.$$

Line $$MN$$ is perpendicular to line $$PQ.$$

Calculate the coordinates of point $$N$$ and length $$MN.$$

Initial considerations:


 * Points $$M, P$$ may be the same point in which case points $$M,N,P$$ are the same point and lengths $$MN=NP=PM=0.$$


 * Point $$M$$ may be on line $$PQ$$ in which case lengths $$PM=PN$$ and length $$MN=0.$$


 * line $$MP$$ may be perpendicular to line $$PQ$$ in which case lengths $$MP=MN$$ and length $$PN=0.$$

Calculate direction cosines of line $$PQ$$: $$[A1,B1,C1].$$

Calculate direction cosines of line $$PM$$: $$[A2,B2,C2].$$

Calculate $$\cos(\theta).$$

Calculate length $$PM.$$

Calculate length $$PN = PM\cdot \cos(\theta).$$

Let point $$P$$ have coordinates $$(x_1,y_1,z_1)$$

Then point $$N = ( x_1+$$length$$PN*A1,\ y_1+$$length$$PN*B1,\ z_1+$$length$$PN*C1 ).$$

Calculate length $$MN.$$

By extending line PQ with constant K
Let line $$PN$$ be defined as

Let point $$N$$ have coordinates

Let point $$M$$ have coordinates

Then line $$MN$$ has direction numbers

Lines $$MN, PN$$ are normal. Therefore:

$$A(p+KA-s) + B(q+KB-t) + C(r+KC-u) = 0$$ and

$$K = \frac{As - Ap + Bt - Bq + Cu - Cr}{A^2 + B^2 + C^2}.$$

Use this value of $$K$$ to calculate the coordinates of point $$N$$ and the direction numbers of line $$MN.$$

Example:

is defined as

Point  has coordinates

Calculate coordinates of point  on   so that line is normal to

Distance between two parallel lines:

Let $$M$$ be a point on a line parallel to line $$PQ.$$

Distance between the two lines is length $$MN.$$

Points of closest approach
Points of closest approach are the 2 points at which the distance between 2 skew lines is minimum.

Let 2 lines be  and. Verify that the lines are not parallel.

Calculate point $$P_1$$ on    and  point $$P_2$$ on    so that line $$P_1P_2$$ is normal to   and line $$P_2P_1$$ is normal to

It's possible that length $$P_1P_2$$ may be zero in which case points $$P_1, P_2$$ are the same point and the lines intersect.

Let  be defined as point $$(p,q,r)$$ with direction numbers $$[A_1,B_1,C_1].$$

Let  be defined as point $$(s,t,u)$$ with direction numbers $$[A_2,B_2,C_2].$$

Calculate the direction numbers of the normal: $$[A_3,B_3,C_3].$$

Relative to  point $$P_1 = ( p+K_1\cdot A_1,\ q+K_1\cdot B_1,\ r+K_1\cdot C_1)$$

and point $$P_2 = ( p+K_1\cdot A_1+K_3\cdot A_3,\ q+K_1\cdot B_1+K_3\cdot B_3,\ r+K_1\cdot C_1+K_3\cdot C_3).$$

Relative to  point $$P_2 = ( s+K_2\cdot A_2,\ t+K_2\cdot B_2,\ u+K_2\cdot C_2)$$

Therefore:

$$p+K_1\cdot A_1+K_3\cdot A_3 = s+K_2\cdot A_2$$

$$q+K_1\cdot B_1+K_3\cdot B_3 = t+K_2\cdot B_2$$

$$r+K_1\cdot C_1+K_3\cdot C_3 = u+K_2\cdot C_2$$

or:

$$A_1\cdot K_1 - A_2\cdot K_2 + A_3\cdot K_3 + p - s = 0\ \dots\ (1)$$

$$B_1\cdot K_1 - B_2\cdot K_2 + B_3\cdot K_3 + q - t = 0\ \dots\ (2)$$

$$C_1\cdot K_1 - C_2\cdot K_2 + C_3\cdot K_3 + r - u = 0\ \dots\ (3)$$

This is a system of three equations with three unknowns: $$K_1, K_2, K_3.$$

If $$[A_3,B_3,C_3]$$ are direction cosines, $$K_3 =$$ length $$P_1P_2.$$

Example 1:

For function  see  "Solving_3_by_4"

Example 2:

Two lines are defined as:

and

Calculate the points of closest approach.

In this case, $$K_3 = 0$$ and the lines intersect at point $$(3,-5,11).$$

=The plane in 3 dimensions=

In two dimensions the point that is always equidistant from two fixed points is the line.

In three dimensions the point that is always equidistant from two fixed points is the plane.

Let point $$P_1$$ have coordinates $$(a,b,c).$$

Let point $$P_2$$ have coordinates $$(d,e,f).$$

Distance $$P_1P_2$$ must be non-zero.

Let point $$P_{xyz}$$ have coordinates $$(x,y,z).$$

Then length $$P_1 P_{xyz}$$ = length $$P_2 P_{xyz}.$$

$$(x-a)^2 + (y-b)^2 + (z-c)^2 = (x-d)^2 + (y-e)^2 + (z-f)^2$$

$$x^2 -2ax + a^2 + y^2 - 2by + b^2 + z^2 - 2cz + c^2 $$$$= x^2 -2dx + d^2 + y^2 - 2ey + e^2 + z^2 - 2fz + f^2$$

$$ -2ax + a^2 - 2by + b^2 - 2cz + c^2 =  -2dx + d^2 - 2ey + e^2  - 2fz + f^2$$

$$ -2ax - 2by - 2cz + a^2 + b^2 + c^2 =  -2dx - 2ey - 2fz + d^2  + e^2  + f^2$$

$$ 2(d-a)x + 2(e-b)y + 2(f-c)z + a^2 + b^2 + c^2 - (d^2  + e^2  + f^2)= 0 $$

This equation has the form $$Ax + By +Cz + D = 0$$ where:

$$A= 2(d-a);\ d-a = \frac{A}{2}$$

$$B= 2(e-b);\ e-b = \frac{B}{2}$$

$$C= 2(f-c);\ f-c = \frac{C}{2}$$

$$D = a^2 + b^2 + c^2 - (d^2 + e^2  + f^2)$$

Normal to the plane:
Line $$P_1P_2$$ is normal to the plane and it has direction numbers $$[d-a, e-b, f-c]$$ or $$[\frac{A}{2},\frac{B}{2},\frac{C}{2}].$$

When a plane is defined as $$Ax+By+Cz+D = 0,$$ the line normal to the plane has direction numbers $$[A,B,C].$$

Distances:
Distance $$P_1P_2 = \sqrt{(d-a)^2 +(e-b)^2 +(f-c)^2}$$ $$=\sqrt{    (\frac{A}{2})^2 +   (\frac{B}{2})^2 +  (\frac{C}{2})^2   }$$ $$= \frac{\sqrt{A^2 + B^2 + C^2}}{2}  $$

Distance from each point $$P_1,P_2$$ to plane $$= \frac{\sqrt{A^2 + B^2 + C^2}}{4} .$$

Consider the expression $$Ax + By + Cz + D.$$ Substitute $$(d,e,f)$$ or $$(a,b,c)$$ for $$(x,y,z).$$

$$Ad + Be + Cf + D = \frac{A^2 + B^2 + C^2}{4};$$ $$\frac{Ad+Be+Cf+D}{  \sqrt{A^2 + B^2 + C^2}     }$$$$   =\frac{\sqrt{A^2 + B^2 + C^2}}{4} $$

Let $$A_1 = \frac{A}{\sqrt{A^2 + B^2 + C^2} },$$ $$\ B_1 = \frac{B}{\sqrt{A^2 + B^2 + C^2} },$$ $$\ C_1 = \frac{C}{\sqrt{A^2 + B^2 + C^2} }.$$ $$\ D_1 = \frac{D}{\sqrt{A^2 + B^2 + C^2} }.$$

Then $$A_1d + B_1e + C_1f + D_1$$= distance from point $$(d,e,f)$$ to plane.

$$Aa + Bb + Cc + D = \frac{-(A^2 + B^2 + C^2)}{4}.$$

Similarly, $$A_1a + B_1b + C_1c + D_1$$= distance from point $$(a,b,c)$$ to plane with opposite sign.

When the values $$(A,B,C)$$ are all direction cosines, the distance from point $$(a,b,c)$$ to plane $$= Aa+Bb+Cc+D$$ with the sign of the result determined by the position of the point relative to the origin.

If on the same side of the plane as the origin, the sign of the result is the sign of D.

If on the side of the plane opposite to that of the origin, the sign of the result is the sign of -D.

To visualize the plane:
Think of the normal to the plane. The normal has direction numbers $$[A,B,C].$$ The plane is perpendicular to the normal.

Note which direction number or numbers are missing. The plane is parallel to the missing axes.

The plane $$x=4$$ is parallel to both $$Y,Z$$ axes.

The plane $$y=3$$ is parallel to both $$X,Z$$ axes.

The plane $$z=-2$$ is parallel to both $$X,Y$$ axes.

The plane $$3x - 4y + 7 = 0$$ is parallel to the $$Z$$ axis.

The plane $$3x - 4z = 7$$ is parallel to the $$Y$$ axis.

The plane $$3y - 4z = 7$$ is parallel to the $$X$$ axis.

The plane $$9x - 8y + 12z + 9 = 0$$ is not parallel to any axis.

By definition above
Given two points as above, the equation $$Ax + By + Cz + D = 0$$ may be calculated.

If this is too complicated, calculate the three direction numbers and the point midway between the two given points. Proceed as under "Point and direction numbers" below.

By point and direction numbers
A point and direction numbers usually define a line. In this case it is a special line, the line normal to the plane with the given point being a point in the plane.

Given $$((x_1,y_1,z_1),[A_1,B_1,C_1]):$$

The equation of the plane is $$A_1x + B_1y + C_1z + D = 0$$ where $$D = -(A_1x_1 + B_1y_1 + C_1z_1).$$

By three points
Verify that the three points form a real triangle with all sides non-zero.

From the three points produce two groups of direction numbers. Calculate the direction numbers of the normal to the two groups of direction numbers. Using any one of the points and the direction numbers of the normal proceed as under "Point and direction numbers" above.

Plane and line
Given a plane and a line in 3 dimensions some relevant questions are:


 * Is the line parallel to the plane? if so, what is distance from line to plane?


 * If not parallel, what is the point within the plane at which the line enters the plane?

Let the plane be defined as: $$Ax + By + Cz + D = 0.$$

Let the line be defined as point $$(x_1, y_1, z_1)$$ and direction numbers $$[A_1, B_1, C_1].$$

The point at which the line enters the plane is: $$(x_1 + KA_1, y_1+KB_1, z_1+KC_1).$$

These points satisfy the equation of the plane:

$$A(x_1 + KA_1) + B(y_1+KB_1) + C(z_1+KC_1) + D = 0$$

$$K = \frac{-(+ Ax_1 + By_1 + Cz_1 + D )}{AA1 + BB1 + CC1}.$$

The divisor $$AA1 + BB1 + CC1$$ is the top line of the equation for $$\cos \theta,$$ angle between two lines.

If $$\cos \theta == 0,$$ the angle between line and normal to the plane is $$90^\circ$$ and line is parallel to plane.

The point of intersection is: $$(x_1 + KA_1, y_1+KB_1, z_1+KC_1).$$

If the direction numbers $$[A_1, B_1, C_1]$$ are all direction cosines, distance from point to plane along the line is $$K.$$

For example:

In the diagram point $$P$$ has coordinates $$(8,11,-12).$$

Line $$PR$$ through $$P$$ has direction numbers $$[5,25,-7].$$

Point $$R$$ is within the plane $$9x + 12y + 8z +181 = 0.$$

What are the coordinates of point $$R$$?

With $$[ A, B, C ]$$ as direction cosines the coefficients of the plane $$= (A,B,C,D) = ( \frac{9}{17}, \frac{12}{17}, \frac{8}{17}, \frac{181}{17} ).$$

As direction cosines the direction numbers of the line $$= [A_1,B_1,C_1] = [ \frac{5}{\sqrt{699}}, \frac{25}{\sqrt{699}}, \frac{-7}{\sqrt{699}} ].$$

Using $$K = \frac{-(+ Ax_1 + By_1 + Cz_1 + D )}{AA_1 + BB_1 + CC_1} = \frac{-17}{0.643} = -26.4386,$$

The point of intersection $$=(x_1 + KA_1, y_1+KB_1, z_1+KC_1) = (3,-14,-5).$$

Provided that all values $$[A,B,C], [A_1,B_1,C_1]$$ are direction cosines,

$$-(+ Ax_1 + By_1 + Cz_1 + D ) =$$ length $$PQ$$ and $$AA_1 + BB_1 + CC_1 = \cos(\theta).$$

If the value of $$\angle \theta_1$$ is desired, $$\sin (\theta_1) = \cos(\theta).$$

Plane and point
Given a plane and a point in 3 dimensions some relevant questions are:


 * What is distance from point to plane?


 * What is the point within the plane at which the line through the point and normal to plane enters the plane?

Let the plane be defined as: $$Ax + By + Cz + D = 0.$$

Any line normal to the plane has direction numbers $$(A, B, C).$$

Let the point be defined as point $$(x_1, y_1, z_1).$$

Let  be defined as the line through point $$(x_1, y_1, z_1)$$ with direction numbers $$(A, B, C).$$

Ensure that the values $$(A, B, C)$$ are direction cosines.

Use the method above to calculate the point at which  enters the plane.

Distance from point to plane is K. Alternatively, distance from point to plane is $$Ax_1 + By_1 + Cz_1 + D.$$

For example:

is defined as $$9x+12y+8z-108 = 0.$$

Point $$P$$ has coordinates $$(13,20,5).$$


 * At what point $$P_1$$ does the normal through $$P$$ enter ?


 * What is the distance from $$P$$ to $$P_1$$?

Convert the equation of  to direction cosines: $$\frac{9}{17}x+\frac{12}{17}y+\frac{8}{17}z-\frac{108}{17} = 0.$$

Using $$K = \frac{-(+ Ax_1 + By_1 + Cz_1 + D )}{AA1 + BB1 + CC1}.$$

$$K = \frac{-(+ \frac{9}{17}x_1 + \frac{12}{17}y_1 + \frac{8}{17}z_1 -\frac{108}{17} )}{A^2 + B^2 + C^2}$$ $$= -(+ \frac{9}{17}13 + \frac{12}{17}20 + \frac{8}{17}5 -\frac{108}{17} ) = -17.$$

Point $$P_1 = (13-17\frac{9}{17},\ 20-17\frac{12}{17},\ 5-17\frac{8}{17}) = (4,8,-3).$$

Distance from $$P$$ to $$P_1 = -17.$$

Plane and plane
If two planes are parallel:


 * they do not intersect.


 * their normals are parallel.

The distance between two parallel planes $$A_1x + B_1y + C_1z + D_1 = 0$$ and $$A_2x + B_2y + C_2z + D_2 = 0$$ is $$D_1 - D_2$$ provided that both planes are defined with direction cosines.

Intersection of 2 planes:

The intersection of plane and plane is a line. The word "intersection" implies that the two planes are not parallel.

If two planes intersect, the line normal to both normals is parallel to the line of intersection.

As the intersection of two planes, the line cannot be defined by a neat algebraic equation like that of the plane.

However the concept is useful because the intersection of line and plane or line and sphere can be solved with algebra.

The line defined as the intersection of two planes can be defined with the familiar point and direction numbers:

As point and direction numbers:

Line $$PQ$$ is defined as the intersection of two planes  and

Using any point (the origin $$O$$ is convenient,) calculate the coordinates of point $$R$$ within  and on the normal from point $$O$$ to.

Calculate the direction numbers of line $$PQ.$$

Calculate the direction numbers of line $$RS,$$ normal to both lines $$OR, PQ.$$

Point $$S$$ is the point at which line $$RS$$ enters.

Line PQ may be defined as point $$S$$ with direction numbers of line $$PQ.$$

Any point on line $$PQ$$ has distance $$0$$ from both planes  and

Algebraic method:

Let a line be defined by two planes:

$$\pi_1:\ x+y+z+1 = 0$$

$$\pi_2:\ x+2y+3z+4 = 0$$

From $$\pi_1,\pi_2$$ derive other equations:

$$\pi_3:\ y + 2z + 3 = 0\ \dots\ \pi_2 - \pi_1$$

$$\pi_4:\ x - z - 2 = 0\ \dots\ 2\pi_1-\pi_2$$

$$\pi_5:\ 2x + y - 1 = 0\ \dots\ 3\pi_1-\pi_2$$ $$$$

The line may be defined by any 2 of $$\pi_1,\ \pi_2,\ \pi_3,\ \pi_4,\ \pi_5.$$

To find a point on the line, let $$x = 0.$$

From $$\pi_4:\ z = -2$$

From $$\pi_5:\ y = 1$$

Therefore $$(0,1,-2)$$ is a point on the line and the line has direction numbers $$(A,B,C)=(-1,2,-1).$$

Any point on the line has coordinates $$(x+KA,\ y+KB,\ z+KC) = (0+K(-1),\ 1+K(2),\ -2+K(-1)).$$

For proof:

Substitute these values into $$\pi_1:$$ $$x+y+z+1 = (-K) + (1+2K) + (-2-K) + 1 = 0.$$

Substitute these values into $$\pi_2:$$ $$x+2y+3z+4 = (-K) + 2(1+2K) + 3(-2-K) + 4 = -K + 2 + 4K -6-3K + 4 = 0.$$

Line  defined as intersection of 2 planes:

Reviewing:
Now that information about the plane is available to the reader, some of the concepts above can be reviewed and simplified.

Point and line
Line $$PQ$$ and point $$M$$ are given.

Calculate the coordinates of point $$N$$ on line $$PQ$$ so that line $$MN$$ is normal to line $$PQ.$$

Calculate the direction numbers of line $$PQ:\ (A,B,C).$$

Using $$(A,B,C)$$ and point $$M$$ calculate the plane normal to line $$PQ$$ and containing point $$M,$$ plane $$MNR.$$

Point $$N$$ is the point at which line $$PQ$$ enters plane $$MNR.$$

Points of closest approach
Lines $$PQ,RS$$ are skew.

Calculate point $$R$$ so that distance from point $$R$$ to line $$PQ$$ is minimum.

Calculate direction numbers of line $$RT$$ normal to both $$PQ, RS.$$

Calculate direction numbers of line $$UV$$ normal to both $$PQ, RT.$$

Using direction numbers of line $$UV$$ and point $$P$$ or point $$Q,$$ calculate plane $$PQT.$$

Point $$R$$ is the point at which line $$SR$$ enters plane $$PQT.$$

Three planes
The intersection of 3 planes is a point. The word "intersection" implies that the three planes actually intersect.

Given three random planes, there are two situations that do not produce a point of intersection:


 * If two of the planes are parallel.


 * If the three planes form a "tent" or "awning."

In diagram to the right:


 * No two planes are parallel.


 * The line of intersection of any 2 planes is parallel to the third plane.

For example, line $$CD$$ is the line of intersection of two planes

Line $$CD$$ is parallel to  and there is no point of intersection.

Point of intersection:

In the diagram line $$CD$$ is line of intersection of two planes

Point $$E$$, the point of intersection of the 3 planes, is the point at which line $$CD$$ enters

Similarly:


 * Line $$EF$$ is common to  Point $$E$$ is the point at which line $$FE$$ enters


 * Line $$EG$$ is common to  Point $$E$$ is the point at which line $$GE$$ enters

=The sphere=

The sphere is the locus of a point that is always a fixed non-zero distance from a given fixed point.

Let the point be  and the distance be

Let  be any point on the surface of the sphere.

Then $$(x-d)^2 + (y-e)^2 + (z-f)^2 = r^2$$

$$x^2 - 2dx + d^2 + y^2 - 2ey + e^2 + z^2 - 2fz + f^2 = r^2$$

$$x^2 + y^2 + z^2 - 2dx - 2ey - 2fz + d^2 + e^2 + f^2 - r^2 = 0$$

$$x^2 + y^2 + z^2 + Ax + By + Cz + D = 0$$

where:

$$A = -2d,$$ $$B = -2e,$$ $$C = -2f,$$ $$D = d^2 + e^2 + f^2 - r^2.$$

Given a sphere defined as  the sphere may be defined as  where it is understood that the coefficients of $$(x^2,\ y^2,\ z^2)$$ are

reversing the conversion
Given a sphere defined as  calculate and

$$d = \frac{-A}{2},$$ $$e = \frac{-B}{2},$$ $$f = \frac{-C}{2},$$ $$r = \sqrt{ d^2 + e^2 + f^2 - D }.$$

and

Two definitions of the sphere:


 * , the algebraic definition of the sphere.


 * , the trigonometric definition of the sphere.

examples
Errors in definition:

The tuple  does not define a valid sphere because radius=0.

The tuple  does not define a valid sphere because the value $$( d^2 + e^2 + f^2 - D )$$ is negative. Consequently the value $$r = \sqrt{ d^2 + e^2 + f^2 - D }$$ is a complex number.

Sphere at origin:

If center of sphere is at origin, $$(d, e, f) = (0,0,0).$$

For example, a sphere at origin with radius $$7$$ may be defined as:

or

Point inside, on or outside sphere:

If distance from point to center $$< r,$$ point is inside sphere.

If distance from point to center $$== r,$$ point is on surface of sphere.

If distance from point to center $$> r,$$ point is outside sphere.

A sphere is defined as

3 points are given:

For each point, determine position of point relative to surface of sphere.


 * for point (3,4,3), distance from point to center is  Point is inside sphere.


 * for point (-3,19,0), distance from point to center  Point is on surface of sphere.


 * for point (9,-5,6), distance from point to center is  Point is outside sphere.

Sphere and line
Given a sphere and a line:


 * The line may pierce the sphere in 2 places,


 * The line may touch the sphere in 1 place, or

from the center of the sphere is always greater than the radius of the sphere.
 * The line may not touch or pierce the sphere. In other words, the distance to the line

The possible point/s of intersection may be calculated by trigonometry or by algebra.

Given a sphere defined as  and a line defined as   calculate the point/s of intersection, if any.

By trigonometry:
Let center of sphere $$P = (3,5,-2).$$ and point $$M = (4,-5,10).$$

Calculate coordinates of point $$N$$ on the line so that line $$PN$$ is normal to the given line.

$$N = (5.5, 1, -3.5).$$

Calculate length $$PN = \sqrt{24.5} = 4.949747468305833.$$ This length is less than the radius of the sphere. The line intersects the sphere in 2 points. Let these points be $$S,T.$$

Length $$NS =$$ length $$NT = \sqrt{ (7)^2 - 24.5 } = \sqrt{24.5}.$$$$$$

Redefine the line so that direction numbers are direction cosines: $$\frac{1}{\sqrt{98}},\frac{4}{\sqrt{98}},\frac{-9}{\sqrt{98}}$$

Point $$S = ( 5.5 + \sqrt{24.5}\cdot\frac{1}{\sqrt{98}}, 1 + \sqrt{24.5}\cdot\frac{4}{\sqrt{98}}, -3.5 + \sqrt{24.5}\cdot\frac{-9}{\sqrt{98}} )$$

Point $$T = ( 5.5 - \sqrt{24.5}\cdot\frac{1}{\sqrt{98}}, 1 - \sqrt{24.5}\cdot\frac{4}{\sqrt{98}}, -3.5 - \sqrt{24.5}\cdot\frac{-9}{\sqrt{98}} )$$

Proof:

Distance from point  to center $$= \sqrt{ (6-3)^2 + (3-5)^2 + (-8-(-2))^2 } = 7 =$$ radius.

Distance from point  to center $$= \sqrt{ (5-3)^2 + (-1-5)^2 + (1-(-2))^2 } = 7 =$$ radius.

Direction numbers of line

Direction numbers of line

Lines  and original line are all parallel and all pass through point

Points  are on the original line.

By extending line with constant K
Let the line be defined as point and direction numbers:

Let the point at which the line enters the sphere be:

These values of $$(x,y,z)$$ satisfy the equation of the sphere:

$$x^2 + y^2 + z^2 + Ax + By + Cz + D = 0.$$

Therefore: $$(s+KE)^2 + (t+KF)^2 + (u+KG)^2 + A(s+KE) + B(t+KF) + C(u+KG) + D = 0$$

Expand and the result is:

$$(E^2 + F^2 + G^2)K^2 + (AE + BF + CG + 2Es + 2Ft + 2Gu)K + As + Bt + Cu + D + s^2 + t^2 + u^2 = 0.$$

This is a quadratic equation in $$K:$$

$$A_0K^2 + B_0K + C_0 = 0$$ where:

$$A_0 = E^2 + F^2 + G^2$$

$$B_0 = AE + BF + CG + 2Es + 2Ft + 2Gu$$ and

$$C_0 = As + Bt + Cu + D + s^2 + t^2 + u^2.$$

By algebra:
Let the sphere be defined as $$A_1, B_1, C_1, D_1$$

Let the line be defined as the intersection of 2 planes $$A_2, B_2, C_2, D_2$$ and $$A_3, B_3, C_3, D_3$$

The relevant equations are :

$$x^2 + y^2 + z^2 + A_1x + B_1y + C_1z + D_1 = 0\ \dots\ (1)$$

$$A_2x + B_2y + C_2z + D_2 = 0\ \dots\ (2)$$

$$A_3x + B_3y + C_3z + D_3 = 0\ \dots\ (3)$$

The point/s of intersection are the solution/s of these 3 equations for $$x, y, z.$$

The value/s of $$x$$ are the solution/s of the quadratic equation $$c_2x^2 + c_1x + c_0 = 0.$$

Exchange rows
Rows 2 and 3 may be exchanged, one for the other:

Exchange columns
If data supplied to  produces an error (as above), try exchanging two columns: Exchange appropriate columns in output to produce correct values:

Defined as 4 points
If 4 unique points on surface of sphere are known, the center and radius may be calculated.

From above, equation of sphere is: $$x^2 + y^2 + z^2 + Ax + By + Cz + D = 0$$

When $$x, y, z$$ are known and $$A, B, C, D$$ are unknown the above equation becomes: $$xA + yB + Cz + (1)D + x^2 + y^2 + z^2 = 0\ \dots\ (1)$$

With four points provided, equation $$(1)$$ may be used to construct a system of 4 simultaneous equations that, when solved, provide the values $$(A, B, C, D).$$

For example:

The above matrix of 4 rows by 5 columns is input to function See Solving_M_by_(M+1)

Center as intersection of 3 planes
Let center of sphere be $$(d, e, f).$$

Let 4 points on surface of sphere be $$(a,b,c),\ (g,h,j),\ (k,l,m),\ (n,p,q).$$

$$(d-a)^2 + (e-b)^2 + (f-c)^2 = r^2$$

$$(d-g)^2 + (e-h)^2 + (f-j)^2 = r^2$$

$$(d-k)^2 + (e-l)^2 + (f-m)^2 = r^2$$

$$(d-n)^2 + (e-p)^2 + (f-q)^2 = r^2$$

$$(d-a)^2 + (e-b)^2 + (f-c)^2 = (d-g)^2 + (e-h)^2 + (f-j)^2$$ or

$$(d-a)^2 + (e-b)^2 + (f-c)^2 - ( (d-g)^2 + (e-h)^2 + (f-j)^2 ) = 0\ \dots\ (1)$$

$$(d-a)^2 + (e-b)^2 + (f-c)^2 - ( (d-k)^2 + (e-l)^2 + (f-m)^2 ) = 0\ \dots\ (2)$$

$$(d-a)^2 + (e-b)^2 + (f-c)^2 - ( (d-n)^2 + (e-p)^2 + (f-q)^2 ) = 0\ \dots\ (3)$$

When expanded, equation $$(1)$$ above has the form $$Ad + Be + Cf + D = 0.$$ This is the equation of the plane normal to line $$((a,b,c),\ (g,h,j),$$ 'line'$$)$$ and containing the point midway between points $$(a,b,c),\ (g,h,j).$$ For function  see  "Solving_3_by_4"

=Third line=

Given:


 * has direction numbers


 * has direction numbers


 * is cosine of angle between  and


 * is cosine of angle between  and

Calculate direction numbers of line3.

In the diagram:

has direction cosines $$[a_1, b_1, c_1].$$

has direction cosines $$[a_2, b_2, c_2].$$

$$\theta_1$$ is angle between  and

$$\theta_2$$ is angle between  and

$$= \cos(\theta_1).$$

$$= \cos(\theta_2).$$

Length

Length

Point  has coordinates

Point  has coordinates

is normal to  and contains point

is normal to  and contains point

Point  is on line of intersection of   and and point  is distance   from point

Point  may have no value. $$(\theta_1 + \theta_2 < \angle MON)$$

Point  may have 1 value. $$(\theta_1 + \theta_2 = \angle MON)$$

Point  may have 2 values. $$(\theta_1 + \theta_2 > \angle MON)$$

For function  see  "Solving_3_by_4"

An example:

Rotate line through given angle
Given:


 * defined as


 * wholly within  and with direction numbers


 * angle $$\theta$$

Calculate:


 * direction numbers of  wholly within   and making angle $$\theta$$ with

This is a special case of function  above in which   makes the angle of $$90^\circ$$ with the normal to the plane, and angle $$\theta$$ with A simple example:

Spokes of a wheel
Given:


 * defined as


 * wholly within  and with direction numbers

Rotate  5 times through $$72^\circ,$$ wholly within

5 times $$72^\circ = 360^\circ.$$ After 5 rotations the direction cosines $$[a_1, b_1, c_1]$$ match their initial values.

By algebra
Ensure that all values $$[a_1,b_1,c_1],\ [a_2,b_2,c_2]$$ are direction cosines.

The relevant equations are:

$$a_1 \cdot a_3 + b_1 \cdot b_3 + c_1 \cdot c_3$$  $$\dots\ (1)$$

$$a_2 \cdot a_3 + b_2 \cdot b_3 + c_2 \cdot c_3$$  $$\dots\ (2)$$

$$a_3^2 + b_3^2 + c_3^2 = 1\ \dots\ (3)$$

Because $$a_3$$ may have exactly $$0$$ or $$1$$ or $$2$$ values, $$a_3$$ is the solution of the quadratic equation $$C_2\cdot a_3^2 + C_1\cdot a_3 + C_0 = 0$$ where $$C_2, C_1, C_0$$ are as defined in the python code below.

Then values $$b_3, c_3$$ may be calculated as shown below.

The function above simplifies to:

Normal to 2 lines
This is the special case in which  and the calculation of $$a_3$$ becomes:

$$C_2\cdot a_3^2 = -C_0$$

$$a_3^2 = \frac{A_3^2}{A_3^2 + B_3^2 + C_3^2}$$

$$a_3 = \frac{A_3}{\sqrt{A_3^2 + B_3^2 + C_3^2}}$$

whence: $$b_3 = \frac{a_3\cdot B_3}{A_3} = \frac{B_3}{\sqrt{A_3^2 + B_3^2 + C_3^2}}$$

and $$c_3 = \frac{-(a_3\cdot a_1 + b_3\cdot b_1)}{c_1}$$

Normal to X,Y axes
In this case the result below was derived from "# output line 3" in the Python code above. 3 -0.0, 0.0, 1.0], [-0.0, 0.0, -1.0

=Links to Related Topics=

Coordinate_systems

Functions_(mathematics)/Graphs/Coordinations

Functions_(mathematics)/Graphs

Investigating_3D_geometric_algebra

Line_(Geometry)

Functions_(mathematics)/Graphs/Cartesian_Coordinate