If the angle between two lines is $\frac{\pi}{4}$ and the slope of one of the lines is $\frac{1}{2}$, then the slope of the other line is
Show Hint
Notice that the two resulting values for the slope ($3$ and $-\frac{1}{3}$) are negative reciprocals of each other ($3 \times -\frac{1}{3} = -1$). This is a neat geometric property: the two possible second lines are always perpendicular to each other because they are symmetrically tilted at $45^\circ$ on either side of the first line!
Step 1: Use the angle-between-lines formula. With $m_1=\dfrac12$ and angle $\theta=\dfrac{\pi}{4}$, $\tan\theta=\left|\dfrac{m_1-m_2}{1+m_1m_2}\right|$ and $\tan45^\circ=1$. Step 2: Write the equation cleanly. $\left|\dfrac{\tfrac12-m_2}{1+\tfrac12 m_2}\right|=1$. Multiply numerator and denominator by $2$: $\left|\dfrac{1-2m_2}{2+m_2}\right|=1$. Step 3: Drop the modulus into two cases. Either $1-2m_2=2+m_2$ or $1-2m_2=-(2+m_2)$. Step 4: Solve the first case. $1-2m_2=2+m_2\Rightarrow-1=3m_2\Rightarrow m_2=-\dfrac13$. Step 5: Solve the second case. $1-2m_2=-2-m_2\Rightarrow3=m_2\Rightarrow m_2=3$. Step 6: Collect both slopes. The other line has slope $3$ or $-\dfrac13$. \[ \boxed{m_2=3\ \text{or}\ -\tfrac13} \]