I'm doing exercise 1.2.8(e) in Diamond & Shurman's A First Course in Modular Forms. The problem is to show that $G_{2,N}(\tau) := G_2(\tau)-NG_2(N\tau)$ is in $M_2(\Gamma_0(N))$. To show this, I need to argue that $G_{2,N}$ satisfies $G_{2,N}[\gamma]_2=G_{2,N}$ where $f[\gamma]_2(\tau):=j(\gamma,\tau)^{-2}f(\gamma(\tau))$ is the weight-2 operator for every $\gamma\in\Gamma_0(N)$, and that $G_{2,N}$ is holomorphic on $\mathcal{H}$ and holomorphic at the cusps.
So far, I proven that $G_2(\tau)$ satisfies the transformation formula $$G_2[\gamma]_2(\tau) = G_2(\tau)-\frac{2\pi ic}{c\tau+d},\;\;\;\;\gamma = \begin{bmatrix}a&b\\c&d\end{bmatrix}$$ and that $$\frac{\pi}{j(\gamma,\tau)^2\Im(\gamma(\tau))}=\frac{\pi}{\Im(\tau)}-\frac{2\pi ic}{c\tau+d},$$ and I've concluded that $G_2(\tau) - \frac{\pi}{\Im(\tau)}$ is weight-2 invariant under $SL_2(\mathbb Z)$.
I have no idea how to conclude that $G_{2,N}(\tau)$ is a modular form for $\Gamma_0(N)$. Specifically, how does the weight-2 operator act on $G_{2,N}$? Is it $$G_{2,N}[\gamma]_2(\tau) = (c\tau+d)^{-2}(G_2(\gamma(\tau))-NG_2(\gamma(N\tau)))$$ or $$G_{2,N}[\gamma]_2(\tau) = (c\tau+d)^{-2}(G_2(\gamma(\tau)) - NG_2(N\gamma(\tau))?$$ In either case, $N\gamma(\tau)$ and $\gamma(N\tau)$ are not of the form $\alpha(\tau)$ for some $\alpha\in SL_2(\mathbb Z)$, so how should $G_2(\tau)$ transform?
Moreover, I don't know how to verify that $G_{2,N}$ is holomorphic on $\mathcal{H}$ or at the cusps. I would greatly appreciate detailed answers to both of these.
P.S. This is not homework, I'm simply trying to better understand computational aspects of modular forms.
Note that $\tau \longmapsto NG_2(N\tau)$ is the function $G_2[\gamma]_2$ with $\gamma=\begin{bmatrix}N & 0\\0&1 \end{bmatrix}$. Moreover, if $\gamma’=\begin{bmatrix}a &b\\c&d\end{bmatrix} \in \Gamma_0(N)$, then $$\gamma\gamma’=\begin{bmatrix} Na & Nb \\ c & d\end{bmatrix}=\begin{bmatrix} a & Nb \\ c/N & d\end{bmatrix}\gamma:=\gamma’’\gamma,$$ and $\gamma’’ \in SL_2(\mathbb{Z})$, so that $G_{2,N}[\gamma’]_2(\tau)=G_2(\tau)-\frac{2i\pi c}{c\tau+d}-(G_2[\gamma’’]_2)[\gamma]_2(\tau)=G_2(\tau)-\frac{2i\pi c}{c\tau+d}-NG_2[\gamma’’]_2(N\tau)=G_2(\tau)-\frac{2i\pi c}{c\tau+d}-NG_2(N\tau)+N\frac{2i\pi (c/N)}{(c/N)(N\tau)+d}=G_{2,N}(\tau)$.
Edit: Now let’s address the holomorphicity issues. First, we show that $G_2[\gamma]_2$ is holomorphic everywhere (including at infinity) for any $\gamma \in SL_2(\mathbb{Z})$. Given the transformation formula, it’s enough to show that $G_2$ is holomorphic everywhere and at infinity.
It’s enough to show that $G_2(\tau)$ is holomorphic on the half plane and bounded at infinity. But $G_2(\tau)=2\zeta(2)+2\sum_{c \geq 1}{f(c\tau)}$ where $f(z)=\sum_{d \in \mathbb{Z}}{\frac{1}{(z+d)^2}}$. As $f$ is the sum of a (locally) normally convergent series of holomorphic functions, $f$ is holomorphic.
Now, if $z$ has imaginary part at least $A > 0$ and real part between $-1$ and $1$, then $$f(z)=\sum_{d \in \mathbb{Z}}{\int_{-1/2}^{1/2}{\int_0^t{\frac{-2du}{(z+d+u)^3}}\,dt}},$$ which shows that $|f(z)| \leq 2\sum_{d \in \mathbb{Z}}{\sup_{t \in (d-1/2,d+1/2)}\, |\frac{1}{(z+t)^3}|}$.
The term for $d=0$ is at most $\frac{1}{A^3}$, and the term for $d \geq 1$ is at most $\frac{1}{(A^2+(|d|-1/2)^2)^{3/2} } \leq \frac{8}{(A^2+d^2)^{3/2}} \leq \frac{16}{A^3+|d|^3}$ by convexity.
It follows that $|f(z)| \leq 2A^{-3}+32\sum_{d \geq 1}{(A^3+d^3)^{-1}}$. By separating the cases $d \geq A$ and $d \leq A$, we get finally that $|f(z)| \leq C(A^{-3}+A^{-2})$ where $C$ is a numerical constant.
Since $f$ is $1$-periodic, it follows that $|f(z)| \leq \frac{C}{|Im(z)|^3}+\frac{C}{|Im(z)|^2}$ and therefore the series $\sum_{c \geq 1}{f(cz)}$ converges normally on all $\{Im z > A\}$, $A>0$.
It follows from this and the bound on $f$ that that series is a holomorphic function of $z$ and goes to zero as $Im(z)$ goes to infinity, so that $G_2(z)$ is holomorphic on the half-plane and at the cusps.
Thus, $G_{2,N}$ is also holomorphic on the half-plane, $\Gamma_0(N)$-invariant and bounded (hence holomorphic) at infinity. Moreover, it has a well know Fourier expansion with coefficients in $O(n^2)$, so by Proposition 1.2.4 it is modular.