Solution (source code)

= Solution

For matrices of positive determinant, use the determinant-normalized <slash operator for modular forms>
$$
(f|_k[\alpha])(\tau)=\det(\alpha)^{k-1}f(\alpha\tau)j(\alpha,\tau)^{-k}.
$$
It satisfies the composition law $(f|_k[\alpha])|_k[\beta]=f|_k[\alpha\beta]$. If
$$
\gamma=\begin{pmatrix}a&b\\c&d\end{pmatrix}\in\Gamma_1(N),
\qquad
\alpha_N=\begin{pmatrix}0&-1\\N&0\end{pmatrix},
$$
then
$$
\alpha_N\gamma\alpha_N^{-1}
=\begin{pmatrix}d&-c/N\\-Nb&a\end{pmatrix}\in\Gamma_1(N).
$$
Thus the <Fricke involution> normalizes the group, and the composition law proves that $f|_k[\alpha_N]$ has the required transformation law.

The matrix $\alpha_N$ permutes the rational cusps. Applying it to a local Fourier expansion merely transports that expansion to the image cusp, with a nonzero change of local parameter. It therefore preserves holomorphy and vanishing at every cusp. Hence
$$
f|_k[\alpha_N]\in S_k(\Gamma_1(N)).
$$