First of all, reflection with respect to $y$ axis cannot be handled by formula :
$$S=\frac{1}{1 + m^2}\begin{pmatrix}1-m^2&2m\\2m&m^2-1\end{pmatrix}\tag{1}$$
for the reason that, exceptionally, there is no $m$ for which the $y$ axis has equation $y=mx$ (one could consider that $m \to \infty$ but it would be necessary to invoke a continuity of the symmetry operator...).
Happily, there is an easy way to bypass this difficulty. Here is how.
Let us remark that, in general, $y=mx$ can be written $y=(\tan \alpha) \ x$ where $\alpha$ is the (polar) angle made by the straight line with $x$ axis. Therefore we can identify :
$$m=\tan(\alpha)\tag{2}$$
If we plug (2) into (1), we recognize the so-called "tangent half angle formulas" (https://www.math24.net/weierstrass-substitution/) :
$$S=\begin{pmatrix}\cos(2 \alpha)&\ \ \ \sin(2 \alpha)\\ \sin(2 \alpha)&-\cos(2 \alpha)\end{pmatrix}\tag{3}$$
which has strong similarities with a rotation matrix : it is an isometry matrix (its columns are unit length and are orthogonal). The difference with a rotation matrix is that its determinant is $-1$, attesting that a symmetry reverses figures' orientation).
As a consequence, if one looks for symmetry with respect to $y$ axis, corresponding to an angle $\alpha=\tfrac{\pi}{2}$, plugging this value into (3) gives matrix :
$$S=\begin{pmatrix}\cos(\pi)&\ \ \ \sin(\pi)\\ \sin(\pi)&-\cos(\pi)\end{pmatrix}=\begin{pmatrix}-1&0\\ \ \ 0&1\end{pmatrix}\tag{4}$$