Vectors on the line obey the equation
$$y - mx = 0$$
Let $e_x, e_y$ be Cartesian basis vectors associated with the $x, y$ coordinates, respectively. The above equation implies that any vector $r = x e_x + y e_y$ that lies on the line must satisfy
$$r \cdot n = 0, \quad n = -m e_x + e_y$$
The vector $n$ is the normal vector to the line, perpendicular to the line. The associated unit normal is $\hat n = n/\sqrt{1+m^2}$.
Any vector $a$ can be broken down into a component that is parallel to the line and a component that is perpendicular. This is written $a = a_\parallel + a_\perp$. When the vector is reflected by a reflection map $\underline N$, the perpendicular component changes sign; the parallel component does not. That is,
$$\underline N(a) = a_\parallel - a_\perp = a - 2 a_\perp$$
The perpendicular component $a_\perp$ is given by
$$a_\perp = (a \cdot \hat n) \hat n$$
where $a = a^x e_x + a^y e_y$. You should be able to recognize that this is merely a projection map onto the vector $\hat n$.
Thus, the reflection map is given as
$$\underline N(a) = \underline I(a) - 2(a \cdot \hat n) \hat n$$
where $\underline I$ is the identity map.
From here, one need only evaluate this in terms of basis vectors to find the matrix components.
$$\underline N(e_x) = e_x - 2 (e_x \cdot \hat n) \hat n = e_x - \frac{2(-m)(-m e_x + e_y)}{1 + m^2} = \frac{(1-m^2)e_x + 2m e_y}{1+m^2}$$
and
$$\underline N(e_y) = e_y - 2 (e_y \cdot \hat n) \hat n = e_y - \frac{2(1)(-me_x + e_y)}{1+m^2} = \frac{2m e_x + (m^2 - 1)e_y}{1+m^2}$$
Both of these are columns of the associated matrix representation.