Example | Algebra |
---|---|
1) Find the Equation of the Perpendicular Line (using the General Equations)The slope of the perpendicular line is the negative reciprocal of the slope of the line. So, for the line: $$ y = 2x - 1 \tag{1} $$ the slope is m: $$ \text{slope} = 2 $$ Therefore, the slope of the perpendicular line is: $$ \text{perpendicular slope} = m_p $$ $$ m_p = -\frac{1}{2} $$ To find the equation of the perpendicular line we can substitute in the point (p1) into the general equation for a straight line (Eqn 3) and solve for the intercept bp . $$ p_1 = (-4, 6) $$ Equation for perpendicular line: $$ y = m_p x + b_p $$ $$ 6 = -\frac{1}{2} (-4) + b_p $$ Simplifying gives: $$ 6 = 2 + b_p $$ Solving for bp , we subtract mpx1 from both sides: $$\begin{aligned} 6 &= 2 + b_p \\ 6 - 2 &= b_p \\ 4 &= b_p \\ b_p &= 4 \end{aligned}$$ Therefore the equation for the perpendicular line is: $$ y = -\frac{1}{2} x + 4 \tag{2}$$ |
1) Find the Equation of the Perpendicular Line
We first need to find the equation of the perpendicular line.
The slope of the perpendicular line is the negative reciprocal of the slope of the line. So, for the line: $$ y = mx + b \tag{3} $$ the slope is m: $$ \text{slope} = m $$ Therefore, the slope of the perpendicular line is: $$ \text{perpendicular slope} = m_p $$ $$ m_p = -\frac{1}{m} $$ To find the equation of the perpendicular line we can substitute in the point (p1) into the general equation for a straight line (Eqn 1) and solve for the intercept bp . $$ p_1 = (x_1, y_1) $$ Equation for perpendicular line: $$ y = mx + b $$ $$ y_1 = m_p x_1 + b_p $$ Solving for bp , we subtract mpx1 from both sides: $$\begin{aligned} y_1 &= m_p x_1 + b_p \\ y_1 - m_p x_1 &= b_p \\ b_p &= y_1 - m_p x_1 \end{aligned}$$ |
2) Find the Intersection Point of the Two Lines
The lines intersect when they share the same x and y values, therefore at the point of intersection ((xi, yi)):
$$ y = 2x - 1 \tag{1} $$
$$ y = -\frac{1}{2} x + 4 \tag{2} $$
if the y values are the same:
$$ 2x - 1 = -\frac{1}{2} x + 4 $$
then solving for x, we move all the terms with x to the same side:
$$ \begin{align} 2x -1 &= -\frac{1}{2} x + 4 \\
2x + \frac{1}{2} x -1 &= 4 \end{align}$$
and all the constants to the other side:
$$ \begin{align} 2x + \frac{1}{2} x - 1 &= 4 \\
2x + \frac{1}{2} x &= 4 + 1 \\
2x + \frac{1}{2} x &= 5
\end{align}$$
factor out the x:
$$ \begin{align} 2x + \frac{1}{2} x &= 5 \\
\left(2 + \frac{1}{2}\right) x &= 5 \\
\frac{5}{2} x &= 5
\end{align}$$
and multiply by the reciprocal of the constant with the x:
$$ \left( \frac{2}{5} \right) \cdot \frac{5}{2} x = 5 \cdot \left( \frac{2}{5} \right) $$
to get:
$$ x = 2 \tag{4}$$
which we can plug into either one of the two equations (let's do the first one: Eqn 4) to get y:
$$ y = 2 (2) - 1$$
this:
$$ y = 3 \tag{5}$$
Therefore the intersection point is:
$$ p_i = (2, 3) \tag{6} $$
|
2) Find the Intersection Point of the Two Lines
The lines intersect when they share the same x and y values, therefore at the point of intersection ((xi, yi)):
$$ y_i = mx_i + b \tag{7} $$
$$ y_i = m_p x_i + b_p \tag{8} $$
if the y values are the same:
$$ mx_i + b = m_p x_i + b_p $$
then solving for xi, we move all the terms with x to the same side:
$$ \begin{align} m x_i + b &= m_p x_i + b_p \\
m x_i - m_p x_i + b &= b_p \end{align}$$
and all the constants to the other side:
$$ \begin{align} m x_i - m_p x_i + b &= b_p \\
m x_i - m_p x_i &= b_p - b \end{align}$$
factor out the x:
$$ \begin{align} m x_i - m_p x_i &= b_p - b \\
(m - m_p) x_i &= b_p - b \end{align}$$
and divide:
$$ \frac{(m - m_p) x_i}{(m - m_p)} = \frac{b_p - b}{(m - m_p)} $$
to get:
$$ x_i = \frac{b_p - b}{m - m_p} \tag{9}$$
which we can plug into either one of the two equations (let's do the first one: Eqn 4) to get y:
$$ y_i = m \frac{b_p - b}{m - m_p} + b \tag{10}$$
|
Find the Distance between the Two Points
We now have two points:
$$ p_1 = (-4, 6) $$
$$ p_i = (2, 3) $$
The distance equation between points is:
$$ d = \sqrt{(x_2-x_1)^2 + (y_2-y_1)^2} $$
therefore:
$$ d = \sqrt{(2-(-4))^2 + (3-6)^2} $$
$$ d = \sqrt{(2+4)^2 + (-3)^2} $$
$$ d = \sqrt{(6)^2 + (-3)^2} $$
$$ d = \sqrt{36 + 9} $$
$$ d = \sqrt{45} $$
$$ d = 6.7 $$
|
We now have two points:
$$ p_1 = (x_1, y_1) $$
$$ p_i = (x_i, y_i) $$
The distance equation between points is:
$$ d = \sqrt{(x_2-x_1)^2 + (y_2-y_1)^2} $$
therefore:
$$ d = \sqrt{(x_i - x_1)^2 + (y_i - y_1)^2} $$
|
Assignment: Write a program
Write a program to find the perpendicular distance between the point:
and the line:
|
Results:
|