# Line (geometry)

Line (Geometry)
The word "line" is open to many different interpretations, as in:
"That horse is descended from a great line of thoroughbreds." or
"Toe the line, or else!"
The concept of "line" in geometry is so basic that a definition may not be necessary. It might be better to say that a definition may not be possible (or adequate.)
Here are some possible definitions:
A line has length but no breadth. This "line" could not be seen under the most powerful microscope.
A line is the shortest possible distance between two fixed points. In astronomy the shortest possible distance between two fixed points might be curved. Some wit might argue that there is no such thing as a fixed point. After all every point on the surface of the earth is always moving.
A line is the locus of a point that moves from one fixed point to a second fixed point so that the distance traveled is the minimum possible. With current technology the minimum possible distance between New York City and Rome follows the curvature of the earth.
The word "point" has been mentioned but not defined. Can we define a point?
If you draw a "line" on a piece of paper and then crumple the paper, what does this do to the line?
In this page the "line" is described in the context of Cartesian geometry in exactly two dimensions.

## Line in Cartesian Geometry

How many lines do you see in Figure 1? The answer takes us into a mixture of philosophy and geometry.
One answer might be: "None. I see many images, each with the appearance of a rectangle and each containing a line such as $y=2x+1$ or $x=-2$."
"You can't see the whole line $x=-2$. At best all you can see is a segment of the line between $y=-5,\ y=5.$"
"Are the limits $5,-5$ included or excluded?"
"Do you see the red line?"
"I see a red image with the appearance of a rectangle (or trapezoid, I can't be sure), probably representing the line $y={\frac {1}{2}}x+1$, but it could represent the line $y=0.49999999999x+1.000000000001$."
A second answer might be: "Too many for the current discussion. After all, the character $-4$ contains 5 lines."
Let's go back to the original question: "How many lines do you see in Figure 1?"
While I see many more than 3, it seems that there are 3 of interest to this discussion and I answer: "Three."
"Describe them."
"A red line with equation $y=0.5x+1$, a blue line with equation $y=0.5x-1$ and a green line with equation $y=2x+1.$"
Despite the possibility of endless limitations and diversions such as those mentioned above, we accept this answer as satisfactory for the current discussion.
The line defined.
In figure 1, the blue line may be defined as just that: "the blue line." However, if we are to answer profound questions about the blue line, such as "How far is the blue line from the red?" or "Where do the blue and green lines intersect?" we need to define the blue line in algebraic terms.
The blue line is the line that passes through points $(-2,-2),(0,-1),(2,0)$ and it has equation $y=f(x)=Ax^{2}+Bx+C$.
Calculate the values of $A,B,C$:
$-2=A(-2)^{2}+B(-2)+C;\ 4A-2B+C=-2$
$-1=A(0)^{2}+B(0)+C;\ C=-1$
$0=A(2)^{2}+B(2)+C;\ 4A+2B+C=0$
$4A-2B+(-1)=-2;\ 4A-2B=-1\ \dots \ (1)$
$4A+2B+(-1)=0;\ 4A+2B=1\ \dots \ (2)$
$(1)+(2),\ A=0.$
$(2)-(1),\ 4B=2;\ B={\frac {1}{2}}$
and the equation of the blue line becomes: $y=(0)x^{2}+({\frac {1}{2}})x+(-1)={\frac {1}{2}}x-1$. This equation has the form $y=mx+g$ where:
$m=$ slope of blue line $={\frac {1}{2}}$ and $g=$the $y\ intercept=-1$, the value of $y$ at the point $(0,-1)$ where the line and the $y\ axis$ intersect.
The red and green lines both intersect the $y\ axis\ (x=0)$ at the point $(0,1)$. The $y$ intercept is $1$.
The red line has equation $y=m_{1}x+1.$ The green line has equation $y=m_{2}x+1.$
Slope of line
See Figure 2. The oblique line passes through points $(x_{1},y_{1})=(-2,-4),\ (x_{2},y_{2})=(0,-1).$
$m={\frac {y_{2}-y_{1}}{x_{2}-x_{1}}}={\frac {-1-(-4)}{0-(-2)}}={\frac {3}{2}}.$ The oblique line has equation $y={\frac {3}{2}}x+g$ and it passes through the point $(-2,-4).\ g=y-{\frac {3}{2}}x=-4-{\frac {3}{2}}(-2)=-4+3=-1.$ The $y$ intercept is $-1$ and:
Oblique line has equation $y={\frac {3}{2}}x-1.$
Back to Figure 1. By inspection, $m_{1}={\frac {1}{2}}$ and the red line has equation $y={\frac {1}{2}}x+1,\ m_{2}=2$ and the green line has equation $y=2x+1.$
Parallel lines
See Figure 3. The three colored lines are parallel because they all have the same slope $({\frac {1}{2}}).$
Remember that the lines $x=-4;\ x=-3;\ \dots \ x=4$ are all parallel, as are the lines $y=-4;\ y=-3;\ \dots \ y=4.$
Lines with same $y$ intercept
See Figure 4. The colored lines represent the family of lines that pass through the point $(0,1)$. There is one exception. The line $x=0$ passes through the point $(0,1)$ but it cannot be represented by the equation $y=mx+1.$
Note the red line. As $x$ increases, $y$ decreases, and the line goes down from left to right. Slope of the line is ${\frac {-1}{5}}$ and line has equation $y=-{\frac {1}{5}}x+1.$
Go to top of section "Line in Cartesian Geometry."
Go to top of page ["Line (Geometry)."]

## Line as locus of point

In this section the line is defined as the locus of a point that is always equidistant from two fixed points. In Figure 1 the two fixed points are $G,H$ and the length $GH$ is non-zero. By definition length $PG$ = length $PH.$
Let points $P,G,H$ have coordinates $(x,y),(s,t),(u,v).$
Length $PG={\sqrt {(x-s)^{2}+(y-t)^{2}}}$
Length $PH={\sqrt {(x-u)^{2}+(y-v)^{2}}}$
$PG=PH.$ Therefore:
${\sqrt {(x-s)^{2}+(y-t)^{2}}}={\sqrt {(x-u)^{2}+(y-v)^{2}}}$
$(x-s)^{2}+(y-t)^{2}=(x-u)^{2}+(y-v)^{2}$
$(x-s)^{2}+(y-t)^{2}-(\ (x-u)^{2}+(y-v)^{2}\ )=0$
Expand and the result is:
$2(u-s)x+2(v-t)y+ss+tt-uu-vv=0$
This equation has the form:$Ax+By+C=0$ where:
$A=2(u-s);\ B=2(v-t);\ C=s^{2}+t^{2}-u^{2}-v^{2}.$
In Figure 1 the line through points $JP$ has equation $5x-12y+15=0.$
If defined as the locus of a point equidistant from points $(s,t)=(2,-12),\ (u,v)=(-8,12),$ the calculation of $A,B,C$ produces the equation $-20x+48y-60=0.$
If defined as the locus of a point equidistant from points $(s,t)=(-1,29),\ (u,v)=(19,-19),$ the calculation of $A,B,C$ produces the equation $40x-96y+120=0.$
Distance from point to line
Length $GH={\sqrt {(u-s)^{2}+(v-t)^{2}}}={\sqrt {({\frac {A}{2}})^{2}+({\frac {B}{2}})^{2}}}={\frac {1}{2}}{\sqrt {A^{2}+B^{2}}}$.
Length $GH$ is non-zero. Therefore, at least one of $A,B$ must be non-zero.
Length $GJ={\frac {1}{4}}{\sqrt {A^{2}+B^{2}}}=$ distance from point $G$ to line.
Consider the expression $Ax+By+C$ and substitute $(u,v)$ for $(x,y).$
We show that $Au+Bv+C={\frac {A^{2}+B^{2}}{4}}$ or $4(Au+Bv+C)=A^{2}+B^{2}.$
If you make the substitutions and expand, you will see that the equality is valid.
Therefore ${\frac {Au+Bv+C}{\sqrt {A^{2}+B^{2}}}}={\frac {\sqrt {A^{2}+B^{2}}}{4}}=$ distance from point $H$ to line.
Similarly we can show that ${\frac {As+Bt+C}{\sqrt {A^{2}+B^{2}}}}=-{\frac {1}{4}}{\sqrt {A^{2}+B^{2}}}=$ distance from point $G$ to line.
If the equation of the line has form: ${\frac {Ax+By+C}{\sqrt {A^{2}+B^{2}}}}=0$ then
${\frac {A}{\sqrt {A^{2}+B^{2}}}}x+{\frac {B}{\sqrt {A^{2}+B^{2}}}}y+{\frac {C}{\sqrt {A^{2}+B^{2}}}}=0$
$($ coefficient of $x)^{2}+($ coefficient of $y)^{2}$ $={\frac {A^{2}}{A^{2}+B^{2}}}+{\frac {B^{2}}{A^{2}+B^{2}}}={\frac {A^{2}+B^{2}}{A^{2}+B^{2}}}=1.$
If the equation of the line $Ax+By+C=0$ has $A^{2}+B^{2}=1,$
the distance from point $(s,t)$ to the line is $As+Bt+C,$
the distance from point $(u,v)$ to the line is $Au+Bv+C,$ and $As+Bt+C=-(Au+Bv+C).$
Length $GJ$ and length $HJ$ have the same absolute value with opposite signs.
Use of multiplier K
Consider the equation ${\frac {Au+Bv+C}{\sqrt {A^{2}+B^{2}}}}={\frac {\sqrt {A^{2}+B^{2}}}{4}}.$ If $(A^{2}+B^{2}==1),$ this doesn't make sense.
To make sense of the relationship introduce a multiplier $K.\ A,B,C$ become $KA,KB,KC$ and the relationship is:
${\frac {KAu+KBv+KC}{\sqrt {(KA)^{2}+(KB)^{2}}}}={\frac {\sqrt {(KA)^{2}+(KB)^{2}}}{4}}$
${\frac {K(Au+Bv+C)}{K{\sqrt {(A)^{2}+(B)^{2}}}}}={\frac {K{\sqrt {(A)^{2}+(B)^{2}}}}{4}}$
If $(A^{2}+B^{2}==1),\ Au+Bv+C={\frac {K}{4}}.$
Consider the line ${\frac {3}{5}}x+{\frac {4}{5}}y+4=0$ and the point $(7,-4).$
${\frac {3}{5}}(7)+{\frac {4}{5}}(-4)+4=5={\frac {K}{4}}.\ K=20.$
If the equation of the line is expressed as $20({\frac {3}{5}}x+{\frac {4}{5}}y+4)=12x+16y+80=0,$
the equation makes sense, but the $LHS$ doesn't change.
$LHS={\frac {12(7)+16(-4)+80}{\sqrt {12^{2}+16^{2}}}}={\frac {84-64+80}{20}}={\frac {100}{20}}=5;\ RHS={\frac {20}{4}}=5.$
$\ LHS=RHS=5,$ the distance from point $(7,-4)$ to the line as calculated above with equation ${\frac {3}{5}}x+{\frac {4}{5}}y+4=0.$
Calculation of the equation of the line equidistant from points $(7,-4),(1,-12)$ initially produces: $12x+16y+80=0.$ Calculation of the equation of the line equidistant from points $(10,0),(-2,-16)$ initially produces: $24x+32y+160=0.$
Go to top of this section "Line as locus of point."
Go to top of first section "Line in Cartesian Geometry."
Go to top of page ["Line (Geometry)."]

## Normal form of line

See Figure 1. The green line through point $N$ has equation $y={\frac {3}{4}}x+25$ or $-{\frac {3}{5}}x+{\frac {4}{5}}y-20=0.$
The normal $ON$ to the line from the origin has length $p=20.$
Let $\angle XON=$ ω$.\ \cos$ ω $={\frac {-3}{5}}.\ \sin$ ω $={\frac {4}{5}}.$
The normal $ON$ to the line is in the quadrant where cosine $(-{\frac {3}{5}})$ is negative and sine $({\frac {4}{5}})$ is positive.
The normal form of the equation is $x\ \cos$ ω $+\ y\ \sin$ ω $-\ p=0$ or $x(-{\frac {3}{5}})+y({\frac {4}{5}})-20=0.$
This puts the origin on the negative side of the line.
Directed distance from line to origin $=NO=-p=-20.$ Directed distance from origin to line $=ON=p=20.$
Components of the normal form
See Figure 2. This example shows line ${\frac {3}{5}}x+{\frac {4}{5}}y-20=0$ with point $P$ on the line.
The normal to the line is in the quadrant where cosine $(0.6)$ is positive and sine $(0.8)$ is positive.
$\angle XON=$ ω $=\ \angle EXP.$
$\cos$ ω $={\frac {3}{5}};\ \sin$ ω $={\frac {4}{5}}.\ ON$ is the normal with length $p=20.$ Point $P$ has coordinates $(20,10).$
$OX=x=20.\ {\frac {OD}{OX}}=\cos$ ω $={\frac {OD}{x}};\ OD=x\ \cos$ ω $=20({\frac {3}{5}})=12.$
$XP=y=10.\ {\frac {EP}{XP}}=\sin$ ω $={\frac {EP}{y}};\ EP=y\ \sin$ ω $=10({\frac {4}{5}})=8.$
$DN=EP=8.$
$OD+DN=12+8=20=p.$ The point $P$ is on the line.
See Figure 3. This example shows line ${\frac {3}{5}}x-{\frac {4}{5}}y-20=0$ with point $P$ not on the line.
The normal to the line is in the quadrant where cosine $(0.6)$ is positive and sine $(-0.8)$ is negative.
$$$$$$ $\angle XON=$ ω.
$\cos$ ω $={\frac {3}{5}};\ \sin$ ω $=-{\frac {4}{5}}.\ ON$ is the normal with length $p=20.$ Point $P$ has coordinates $(27.5,7.5).$
$OX=x=27.5.\ {\frac {OD}{OX}}=\cos$ ω $={\frac {OD}{x}};\ OD=x\ \cos$ ω $=27.5({\frac {3}{5}})=16.5.$
$DP_{1}=XE=y\ \sin$ ω $=(7.5)(-{\frac {4}{5}})=-6.$ The negative value for $DP_{1}$ establishes direction towards the origin.
$OP_{1}=OD+DP_{1}=16.5+(-6)=10.5.$ The points $P,P_{1}$ are $10.5-20=-9.5$ from the line indicating $9.5$ units toward the origin.
Normal form in practice
See Figure 4. The green line has equation $-{\frac {3}{5}}x+{\frac {4}{5}}y-20=0$ and point $C\ (-20,10)$ is on the line.
The brown line has equation $-{\frac {3}{5}}x+{\frac {4}{5}}y-10=0$ and point $D\ (6,17)$ is on the line.
The brown and green lines are in the quadrant where cosine $(-{\frac {3}{5}})$ is negative and sine $({\frac {4}{5}})$ is positive.
Distance from brown line to origin $=-{\frac {3}{5}}(0)+{\frac {4}{5}}(0)-10=-10.$
Distance from green line to origin $=-20.$
Distance from green line to point $D\ (6,17)$ $=-{\frac {3}{5}}(6)+{\frac {4}{5}}(17)-20=-{\frac {18}{5}}+{\frac {68}{5}}-20={\frac {50}{5}}-20=-10,$ toward the origin.
Distance from brown line to point $C\ (-20,10)=-{\frac {3}{5}}(-20)+{\frac {4}{5}}(10)-10=12+8-10=10,$ away from the origin.
Distance from green line to brown line $=-20-(-10)=-10,$ toward the origin.
Distance from brown line to green line $=-10-(-20)=10,$ away from the origin.
The purple line has equation ${\frac {3}{5}}x-{\frac {4}{5}}y-10=0$ and point $E\ (6,-8)$ is on the line. The purple line is in the quadrant where cosine $({\frac {3}{5}})$ is positive and sine $(-{\frac {4}{5}})$ is negative. The purple and brown lines are parallel, but in opposite quadrants.
Distance from brown line to point $E\ (6,-8)=-{\frac {3}{5}}(6)+{\frac {4}{5}}(-8)-10=-{\frac {18}{5}}-{\frac {32}{5}}-10=-{\frac {50}{5}}-10=-20,$ toward the origin.
Distance from purple line to point $D\ (6,17)={\frac {3}{5}}(6)-{\frac {4}{5}}(17)-10={\frac {18}{5}}-{\frac {68}{5}}-10=-{\frac {50}{5}}-10=-20,$ toward the origin.
When calculating distance between brown and purple lines, it is important to see that they are in opposite quadrants. If direction is not important, you can say that the brown line has equation ${\frac {3}{5}}x-{\frac {4}{5}}y+10=0,$ and the distance between them is $10-(-10)=20.$
Go to top of this section "Normal form of line."
Go to top of first section "Line in Cartesian Geometry."
Go to top of page ["Line (Geometry)."]

## Direction Numbers

See Figure 1.
The red line has $x$ intercept $(-15,0)$ and $y$ intercept $(0,9).$ Slope of red line $={\frac {9-0}{0-(-15)}}={\frac {9}{15}}={\frac {3}{5}}.$
Red line has equation $y={\frac {3}{5}}x+9.$ When $x$ increases by $1,\ y$ increases by ${\frac {3}{5}}.$ The line has $direction\ numbers\ [A,B]=[1,{\frac {3}{5}}]$ where $A$ represents a change in $x$ and $B$ represents a corresponding change in $y.$ $$
This section shows that the line may be defined using known points and $direction\ numbers.$
Consider the points $Q:(5,12),\ R:(20,21).$ The value of $x$ at $R$ is the value of $x$ at $Q\ +\ (20-5=15).$ The change in $x$ between $Q,R$ is represented by arrow $A_{1}$ with length $15.$ The value of $y$ at $R$ is the value of $y$ at $Q\ +\ (21-12=9).$ The change in $y$ between $Q,R$ is represented by arrow $B_{1}$ with length $9.$
$A_{1},B_{1}$ are the direction numbers of the red line at point $Q.$
The red line passes through point $Q$ with direction numbers $[A_{1},B_{1}]=[15,9].$
Consider the points $R:(20,21),\ P:(-25,-6).\ A_{2}=x_{P}-x_{R}=-25-20=-45;\ B_{2}=y_{P}-y_{R}=-6-21=-27.$
The red line passes through point $R$ with direction numbers $[A_{2},B_{2}]=[-45,-27].$
The direction numbers $[15,9],[-45,-27]$ for the red line are consistent because they represent a ratio, the slope of the line.
Given the point $Q:(5,12)$ and direction numbers $[A_{1},B_{1}]=[15,9],$ the red line can be defined as $(5,12),[15,9]$ and the equation of the red line is
${\frac {y-12}{x-5}}={\frac {9}{15}}={\frac {3}{5}};\ 5(y-12)=3(x-5);\ 5y-60=3x-15;\ 3x-5y+45=0.$
Given the point $P:(-25,-6)$ and direction numbers $[A_{2},B_{2}]=[-45,-27],$ the red line can be defined as $(-25,-6),[-45,-27]$ and the equation of the red line is
${\frac {y-(-6)}{x-(-25)}}={\frac {-27}{-45}}={\frac {3}{5}};\ 5(y+6)=3(x+25);\ 5y+30=3x+75;\ 3x-5y+45=0,$ the same as that calculated above.
For convenience, both sets of direction numbers $[15,9],[-45,-27]$ can be expressed as $[5,3].$
The equation of the red line is given as: $y={\frac {3}{5}}x+9,$ hence direction numbers $[A_{3},B_{3}]=[1,{\frac {3}{5}}]=[5,3].$
Direction numbers are valid only if the distance between the two points of reference is non-zero. Therefore, at least one of $[A,B]$ must be non-zero.
Using direction numbers
1. Format of any point.
Given a line defined as $(x_{1},y_{1}),[A_{1},B_{1}]$ any point on the line has format: $(x_{1}+KA_{1},\ y_{1}+KB_{1}).$ For example, if the red line in Figure 1 is defined as $(5,12),[5,3],$ any point on the line is $(5+5K,12+3K).$ If $(K==-6),$ the point is $(-25,-6)$ or point $P.$
2. Normal to the line.
Refer to the section "Line as locus of a point" above. If the line has equation $Ax+By+C=0,$ the normal to the line has direction numbers $[A,B].$
3. Point at specified distance.
Given a line defined as $(x_{1},y_{1}),[A_{1},B_{1}]$ calculate the two points on the line at distance $d$ from $(x_{1},y_{1}).$
Let one point at distance $d$ from $(x_{1},y_{1})$ have coordinates $(x_{1}+KA_{1},y_{1}+KB_{1}).$
Then $d={\sqrt {(x_{1}+KA_{1}-x_{1})^{2}+(y_{1}+KB_{1}-y_{1})^{2}}}={\sqrt {(KA_{1})^{2}+(KB_{1})^{2}}}=\pm K{\sqrt {A_{1}^{2}+B_{1}^{2}}}$
$K={\frac {\pm d}{\sqrt {A_{1}^{2}+B_{1}^{2}}}}.$
For example, given a line defined as $(-15,0),[5,3]$ calculate the two points on the line at distance $d=3{\sqrt {34}}$ from $(-15,0).$
$K={\frac {\pm 3{\sqrt {34}}}{\sqrt {5^{2}+3^{2}}}}={\frac {\pm 3{\sqrt {34}}}{\sqrt {34}}}=\pm 3.$
The points are: $(-15+3(5),0+3(3)),\ (-15-3(5),0-3(3))$ or $(0,9),\ (-30,-9).$
4. Point at intersection of two lines.
Let one line have equation $Ax+By+C=0$ and let the other be defined as $(x_{1},y_{1}),[A_{1},B_{1}].$
Any point on the second line has format $(x_{1}+KA_{1},\ y_{1}+KB_{1}).$ The point $(x_{1}+KA_{1},\ y_{1}+KB_{1})$ satisfies the first equation. Therefore:
$A(x_{1}+KA_{1})+B(y_{1}+KB_{1})+C=0$
$\ Ax_{1}+AKA_{1}+By_{1}+BKB_{1}+C=0$
$\ K(AA_{1}+BB_{1})=-(Ax_{1}+By_{1}+C)$
$K={\frac {-(Ax_{1}+By_{1}+C)}{AA_{1}+BB_{1}}}.$
If $(AA_{1}+BB_{1}==0),$ the lines are parallel.
5. Angle between two lines.
See Figure 2.
Line $OP$ has direction numbers $[A_{1},B_{1}].$
Line $OQ$ has direction numbers $[A_{2},B_{2}].$
The aim is to calculate the angle between the two lines, $\angle \alpha =\angle POQ.$
$OP={\sqrt {A_{1}^{2}+B_{1}^{2}}}$
$OQ={\sqrt {A_{2}^{2}+B_{2}^{2}}}$
$PQ={\sqrt {(A_{1}-A_{2})^{2}+(B_{1}-B_{2})^{2}}}$
Using the cosine rule $a^{2}=b^{2}+c^{2}-2bc\cos A,$
$PQ^{2}=OP^{2}+OQ^{2}-2(OP)(OQ)\cos \alpha$
$2(OP)(OQ)\cos \alpha =OP^{2}+OQ^{2}-PQ^{2}=A_{1}^{2}+B_{1}^{2}+A_{2}^{2}+B_{2}^{2}-(A_{1}^{2}-2A_{1}A_{2}+A_{1}^{2}+B_{1}^{2}-2B_{1}B_{2}+B_{2}^{2})$
$\cos \alpha ={\frac {2(A_{1}A_{2}+B_{1}B_{2})}{2(OP)(OQ)}}={\frac {A_{1}A_{2}+B_{1}B_{2}}{{\sqrt {A_{1}^{2}+B_{1}^{2}}}{\sqrt {A_{2}^{2}+B_{2}^{2}}}}}$
If $A_{1}A_{2}+B_{1}B_{2}==0,\ \cos \alpha =0$ and the lines are perpendicular.
if $(B_{1}A_{2}==A_{1}B_{2})\ B_{1}={\frac {A_{1}B_{2}}{A_{2}}}$,
$\cos \alpha ={\frac {A_{1}A_{2}+({\frac {A_{1}B_{2}}{A_{2}}})B_{2}}{{\sqrt {A_{1}^{2}+({\frac {A_{1}B_{2}}{A_{2}}})^{2}}}{\sqrt {A_{2}^{2}+B_{2}^{2}}}}}$ $={\frac {\frac {A_{1}A_{2}A_{2}+A_{1}B_{2}B_{2}}{A_{2}}}{{\sqrt {\frac {A_{1}^{2}A_{2}^{2}+A_{1}^{2}B_{2}^{2}}{A_{2}^{2}}}}{\sqrt {A_{2}^{2}+B_{2}^{2}}}}}$ $={\frac {A_{1}A_{2}A_{2}+A_{1}B_{2}B_{2}}{{\sqrt {A_{1}^{2}(A_{2}^{2}+B_{2}^{2})}}{\sqrt {A_{2}^{2}+B_{2}^{2}}}}}$ $={\frac {A_{1}(A_{2}^{2}+B_{2}^{2})}{\pm A_{1}{\sqrt {A_{2}^{2}+B_{2}^{2}}}{\sqrt {A_{2}^{2}+B_{2}^{2}}}}}$ $={\frac {\pm A_{1}(A_{2}^{2}+B_{2}^{2})}{A_{1}(A_{2}^{2}+B_{2}^{2})}}$ $=\pm 1,$ $\alpha =0$° or $\alpha =180$° and the lines are parallel.
Go to top of this section "Direction Numbers."
Go to top of first section "Line in Cartesian Geometry."
Go to top of page ["Line (Geometry)."]

## Direction Cosines

Let the line $OQ$ have direction numbers $[A,B]=[{\frac {A_{2}}{\sqrt {A_{2}^{2}+B_{2}^{2}}}},{\frac {B_{2}}{\sqrt {A_{2}^{2}+B_{2}^{2}}}}].$
The value $A={\frac {A_{2}}{\sqrt {A_{2}^{2}+B_{2}^{2}}}}={\frac {A_{2}}{OQ}}=\cos \angle QOX.$
The value $B={\frac {B_{2}}{\sqrt {A_{2}^{2}+B_{2}^{2}}}}={\frac {B_{2}}{OQ}}=\cos \angle QOY.$
$A^{2}+B^{2}=1$.
When a set of direction numbers $[A,B]$ has $A^{2}+B^{2}=1,$ the direction numbers are direction cosines. In Figure 1 $OP=OQ=1.\ \alpha =\angle POQ.$ All values $A_{1},B_{1},A_{2},B_{2}$ are direction cosines. From 5 above, $\cos \alpha =A_{1}A_{2}+B_{1}B_{2}.$ This statement is equivalent to:
$\cos(\angle POX-\angle QOX)$ $=\cos \angle POX\cos \angle QOX$ $+\sin \angle POX\sin \angle QOX$ or
$\cos(\beta -\delta )=\cos \beta \cos \delta +\sin \beta \sin \delta .$
For example, two lines have direction numbers $[1,1],\ [{\sqrt {3}},1].$ Calculate the angle between them.
Convert to direction cosines: $[{\frac {\sqrt {2}}{2}},{\frac {\sqrt {2}}{2}}],\ [{\frac {\sqrt {3}}{2}},{\frac {1}{2}}].$
$\cos \alpha =A_{1}A_{2}+B_{1}B_{2}={\frac {\sqrt {6}}{4}}+{\frac {\sqrt {2}}{4}}=\cos 15$°.
If $|\cos \alpha |==1,\ \alpha =0$° or $180$°, and the lines are parallel.
If $\cos \alpha ==0,\ \alpha =90$° or $270$°, and the lines are perpendicular.
1. $\cos(2\alpha )$ using direction cosines
In Figure 2 line $OP$ has direction numbers $[A,B],$ line $OQ$ has direction numbers $[A,-B]$ and $OP=OQ=1.$ The values $A,B$ are direction cosines.
$\angle POX=\angle QOX;$ $\angle POQ=2\angle POX.$
$\cos \angle POQ$ $=AA+B(-B)$ $=AA-BB$ $=AA-(1-AA)$ $=2AA-1.$
This statement is equivalent to:
$\cos(2\alpha )=2\cos ^{2}(\alpha )-1$ or $\cos({\frac {\alpha }{2}})=\pm {\sqrt {\frac {\cos(\alpha )+1}{2}}}.$
2. $\cos(3\alpha )$ using direction cosines
See Figure 3.
Lines $OP,OQ,OR$ are defined as $(0,0),[A_{1},B_{1}];$ $(0,0),[A,B];$ $(0,0),[A,-B]$ respectively.
$OP=OQ=OR=1.$
$\angle POX=2\angle QOX,$ therefore: $A_{1}=2AA-1$
$\sin(2\alpha )=B_{1}$ $={\sqrt {1-A_{1}^{2}}}$ $={\sqrt {1-(2AA-1)^{2}}}$ $={\sqrt {1-(4AAAA-4AA+1)}}$ $={\sqrt {4AA-4AAAA}}$ $=2A{\sqrt {1-AA}}=2AB$
$\sin(2\alpha )=2\sin \alpha \cos \alpha .$
$\cos(3\alpha )=\cos \angle POR$ $=A_{1}A+B_{1}(-B)$ $=(2AA-1)A+2AB(-B)$ $=2AAA-A-2A(BB)$ $=2AAA-A-2A(1-AA)$ $=2AAA-A-2A+2AAA$ $=4A^{3}-3A.$
$\cos(3\alpha )=4\cos ^{3}\alpha -3\cos \alpha .$
3. $\sin(\alpha -\beta )$ using direction cosines
See Figure 4.
Lines $OP,OQ$ are defined as $(0,0),[A_{1},B_{1}];$ $(0,0),[A_{2},B_{2}]$ respectively.
$OP=OQ=1.$
$\angle POX=\alpha ;$ $\angle QOX=\beta ;$ $\angle POQ=\alpha -\beta .$
Line $OQ$ has equation $A_{2}y-B_{2}x=0.$
Point $P$ has coordinates $(A_{1},B_{1}).$
Length $PR=A_{2}B_{1}-B_{2}A_{1}$ $=\sin(\alpha -\beta )$ $=\sin \alpha \cos \beta -\cos \alpha \sin \beta .$
4. Bisect angle between lines using direction cosines
See Figure 5. The aim is to produce line $OQ,$ the bisector of $\angle POR.$
Lines $OP,OR$ are defined as $(0,0),[A_{1},B_{1}]$ and $(0,0),[A_{2},B_{2}]$ respectively.
Ensure that all values $A_{1},B_{1},A_{2},B_{2}$ are direction cosines. At least one of $A_{1},B_{1}$ and one of $A_{2},B_{2}$ are non-zero.
Let line $OQ$ have direction numbers $[A,B].$
$\angle POQ=\angle QOR.$
$A_{1}A+B_{1}B=A_{2}A+B_{2}B.$
$B_{1}B-B_{2}B=A_{2}A-A_{1}A.$
$B(B_{1}-B_{2})=A(A_{2}-A_{1}).$
Slope of line $OQ={\frac {B}{A}}={\frac {A_{2}-A_{1}}{B_{1}-B_{2}}}.$
Let line $OQ$ have direction numbers $[A,B]=[B_{1}-B_{2},\ A_{2}-A_{1}].$
if $A\ ==\ 0\ :$ $\ \#\ B_{1}$ equals $B_{2}.$
$\ \ \ \ \ \ \ \$if $B\ ==\ 0\ :$ $\ \#\ A_{1}$ equals $A_{2}.$
$\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \#$ Both lines are parallel and in same direction.
$\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \#$ Three lines $OP,\ OQ,\ OR$ are colinear.
$\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ [A,\ B]\ =\ [A_{1},\ B_{1}]$
$\ \ \ \ \ \ \ \$else : $\ \#\ A_{1}\$equals$\ -A_{2}.$
$\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ [A,\ B]\ =\ [0,\ 1]\ \#$ The $Y$ axis.
elif$\ B\ ==\ 0\ :$ $\ \#\ A_{1}\$equals$\ A_{2}.\ B_{1}\$equals$\ -B_{2}.$
$\ \ \ \ \ \ \ \ [A,\ B]\ =\ [1,\ 0]\ \#$ The $X$ axis.
elif$\ B_{2}\ ==\ -B_{1}\ :$ $\ \#\ A_{2}\$equals$\ -A_{1}.$
$\ \ \ \ \ \ \ \ \#$ The lines are parallel and in opposite directions.
$\ \ \ \ \ \ \ \#\ [A,\ B]\ =\ [B_{1}-(-B_{1}),\ -A_{1}-A_{1}]\ =\ [2B_{1},\ -2A_{1}]$
$\ \ \ \ \ \ \ \ [A,\ B]\ =\ [B_{1},\ -A_{1}]\ \#$ The normal to line $OP$ or line $OR.$
else :$$
$\ \ \ \ \ \ \ \ root\ =\ {\sqrt {A^{2}+B^{2}}}$
$\ \ \ \ \ \ \ \ A\ =\ {\frac {A}{root}};\ B\ =\ {\frac {B}{root}}$
$\cos \angle QOX=A;$ $\sin \angle QOX=B.$
5. $\sin(\alpha +\beta )$ using direction cosines.
See Figure 6.
$OP=OR=1.$
Point $Q$ has coordinates $(A_{1}A_{2},B_{1}A_{2}).$
Line $QP$ is defined as $(A_{1}A_{2},B_{1}A_{2}),[-B_{1},A_{1}].$ Length $QP=B_{2}.$
Point $P$ has coordinates $(x=A_{1}A_{2}+B_{2}(-B_{1}),y=B_{1}A_{2}+B_{2}A_{1}).$
$\cos(\alpha +\beta )=x=\cos \alpha \cos \beta -\sin \alpha \sin \beta .$
$\sin(\alpha +\beta )=y=\sin \alpha \cos \beta +\cos \alpha \sin \beta .$
Go to top of this section "Direction Cosines."
Go to top of first section "Line in Cartesian Geometry."
Go to top of page ["Line (Geometry)."]

## Intercept form of Line

The general equation of the straight line is: $Ax+By+C=0$ where at least one of $A,B$ is non-zero.
The intercept form of the line requires that all of $A,B,C$ be non-zero.
$Ax+By+C=0$
$Ax+By=-C$
${\frac {A}{-C}}x+{\frac {B}{-C}}y=1$
${\frac {x}{-C/A}}+{\frac {y}{-C/B}}=1$
$Ax+By+C=0$
If $(y==0)\ x=-{\frac {C}{A}}.$
If $(x==0)\ y=-{\frac {C}{B}}.$
Let $a=-{\frac {C}{A}},\ b=-{\frac {C}{B}}.$ The line passes through the points $(a,0),(0,b)$ where $a$ is the $x$ intercept and $b$ is the $y$ intercept.
The equation ${\frac {x}{-C/A}}+{\frac {y}{-C/B}}=1$ becomes ${\frac {x}{a}}+{\frac {y}{b}}=1,$ the intercept form of the equation.
See Figure 1. In this example $a=-24,\ b=16.$
The green line has equation ${\frac {x}{-24}}+{\frac {y}{16}}=1.$
Go to top of this section "Intercept form of Line."
Go to top of first section "Line in Cartesian Geometry."
Go to top of page ["Line (Geometry)."]

## Angle of Intersection

See Figure 1.
Given line $OJ$ with equation $Ax+By+C=0$ in which at least 1 of $A,B$ is non-zero and line $OK$ with equation $Dx+Ey+F=0$ in which at least 1 of $D,E$ is non-zero, the aim is to calculate $\angle JOK.$
Let line $OJ$ have slope $m_{1}=-{\frac {A}{B}}$ and
Let line $OK$ have slope $m_{2}=-{\frac {D}{E}}.$
Using $\tan(A-B)={\frac {\tan(A)-\tan(B)}{1+\tan(A)\tan(B)}},$
$\tan(\angle JOK)={\frac {m_{1}-m_{2}}{1+m_{1}m_{2}}}={\frac {BD-AE}{BE+AD}}$ which can never have the value ${\frac {0}{0}}.$
If $(BD-AE==0),\ \tan(\angle JOK)=0,\ \angle JOK=0$ and the two lines are parallel. Also:
$\ \ \ \ \ \ \ \ \ \ BD=AE;\ {\frac {D}{E}}={\frac {A}{B}};\ m_{1}=m_{2}.$
If $(BE+AD==0),\ \angle JOK=90$° and the two lines are perpendicular. Also:
$\ \ \ \ \ \ \ \ \ \$If $(BE==AD),\ BE=AD=0$ and each line is parallel to an axis, else:
$\ \ \ \ \ \ \ \ \ \ AD=-BE;\ {\frac {AD}{BE}}=-1;\ m_{1}m_{2}={\frac {AD}{BE}}.$ If $BE$ is non-zero and $m_{1}m_{2}==-1,$ the lines are perpendicular.
Go to top of this section "Angle of Intersection."
Go to top of first section "Line in Cartesian Geometry."
Go to top of page ["Line (Geometry)."]