Intersecting lines

Consider the two lines given by the equations: \begin{align*} y &= x\\ y &= mx + c \end{align*} These lines intersect at $(x_\star, y_\star) = (c/(1-m), c/(1-m))$. Finding the intersection point is an ill-conditioned problem when $m \approx 1$ (lines nearly parallel).

For example, the lines $y=x$ and $y = (1.01)x + 2$ intersect at $(x_\star, y_\star) = (-200, -200)$. If we perturb $m$ slightly by $\delta m = 0.001$, to $m' = m + \delta m = 1.011$, the intersection point becomes $(x_\star', y_\star') = (-181.8182, -181.8182)$. That is, a relative error of $\delta m / m \approx 0.001$ in $m$ has created a relative error of $|(x_\star' - x_\star)/x_\star| \approx 0.091$, almost 100 times larger.

Conversely, if the lines have very different gradients, the problem is well-conditioned. Take, for example, $m = -1$ (perpendicular lines): the intersection $(1,1)$ becomes (1.0005, 1.0005) under the same perturbation to $m' = m + \delta m = -0.999$, leading to a relative error of 0.0005 which is actually smaller than the relative error in $m$.