angle between straight lines

Hi folks,

I am trying to show that the angle between two straight lines is given by:

$\displaystyle \tan\theta = \frac{m_{1} - m_{2}}{1 + m_{1}m_{2}}$

I am using vector methods but my problem is the algebra. If the vector equation of a line is given by $\displaystyle \overline{r_{1}} = \overline{a_{1}} + \lambda \overline{b_{1}}$. And the second line by subscript 2, the angle between the lines is given by:

$\displaystyle \overline{b_{1}}.\overline{b_{2}} = |b_{1}||b_{2}| \cos\theta$

for a straight line of the form y = mx + c we have:

$\displaystyle r_{1} = \left( \begin{array}{c} x \\ y \end{array} \right) =

\left( \begin{array}{c} 0 \\ c_{1} \end{array} \right) + \lambda

\left( \begin{array}{c} 1 \\ m_{1} \end{array} \right)$

or,

$\displaystyle r_{1} = 0i + c_{1}j + \lambda (i + m_{1}j)$

$\displaystyle r_{2} = 0i + c_{2}j + \lambda (i + m_{2}j)$

So, the angle between the two lines is given by

$\displaystyle (1i + m_{1}j).(1i + m_{2}j) = \sqrt{1 + m^{2}_{1}}\sqrt{1 + m^{2}_{2}}. \cos\theta $

$\displaystyle 1 + m_{1}m_{2} = \sqrt{(1 + m^{2}_{1})(1 + m^{2}_{2})}. \cos\theta $

At this stage I decided to square both sides and look for a chance to combine 1 and $\displaystyle \cos^2\theta $ to give $\displaystyle \sin^2 \theta$ then simplify and take a square root to get back to $\displaystyle \tan\theta $

instead things got very messy indeed. Am I on the right track? I know it's murder trying to type lots of algebra but I suspect there would be less algebra if it was done right! A few lines in the right direction would be greatly appreciated!

best regards