Let $N$ be a positive integer and $p$ a prime not dividing $N$. Let $X\_0(N)$ be the modular curve (over $\mathbb{Q}$) associated to the congruence subgroup $\Gamma\_0(N)$, which is the subgroup of $\text{SL}\_2(\mathbb{Z})$ consisting of upper triangular matrices modulo $N$. Let $\pi\_1$ and $\pi\_p$ be two degeneracy maps from $X\_0(Np)$ to $X\_0(N)$ defined by "forgetting the level $p$ structure" and "dividing by the level $p$ structure" on the associated moduli problem. If we identify $X\_0(Np)(\mathbb{C})\simeq \Gamma\_0(Np)\backslash(\mathbb{H} \cup \mathbb{P}^1(\mathbb{Q}))$ and $X\_0(N)(\mathbb{C})\simeq \Gamma\_0(N)\backslash(\mathbb{H} \cup \mathbb{P}^1(\mathbb{Q}))$, then we have


$$
\pi\_1(z)=z \pmod {\Gamma\_0(N)} ~~\text{ and }~~ \pi\_p(z)=pz \pmod {\Gamma\_0(N)}.
$$
Let $w\_p$ be the Atkin-Lehner involution on $X\_0(Np)$ which satisfies 
$$
\pi\_1\circ w\_p = \pi\_p.
$$


Now, we want to understand how these maps send cusps explicitly.
Let $C(Np)$ and $C(N)$ denote the sets of cusps on $X\_0(Np)$ and $X\_0(N)$, respectively. 
Then the maps $\pi\_1$ and $\pi\_p$ send $C(Np)$ to $C(N)$, and $w\_p$ becomes an involution on $C(Np)$ by restriction. Let
$$
S\_1=\{ (\begin{smallmatrix} x \\ d \end{smallmatrix}) : d \mid N, ~(x, d)=1,~1\leq x \leq d, ~x \text{ taken modulo } (d, N/d) \}
$$
and
$$
S\_2=\{ (\begin{smallmatrix} x \\ dp \end{smallmatrix}) : d \mid N, ~(x, dp)=1,~1\leq x \leq dp, ~x \text{ taken modulo } (dp, N/d) \}.
$$
(Note that $(dp, N/d)=(d, N/d)$.)
Then, we have
$$
C(Np)=S\_1 \cup S\_2 ~\text{ and }~ C(N)=S\_1
$$
(cf. Section 3.8 of Diamond-Shurman's book, A first course in modular forms). I think that from the description of the maps $\pi\_1$ and $\pi\_p$ on $X\_0(Np)(\mathbb{C})$, we have
$$
\pi\_1((\begin{smallmatrix} x \\ d \end{smallmatrix}))=(\begin{smallmatrix} x \\ d \end{smallmatrix}) \text{ and } 
\pi\_p((\begin{smallmatrix} x \\ d \end{smallmatrix}))= (\begin{smallmatrix} y \\ d \end{smallmatrix}),
$$
where $y$ is the remainder of $px$ divided by $d$. Also, we have
$$
\pi\_1((\begin{smallmatrix} x \\ dp \end{smallmatrix}))=(\begin{smallmatrix} z \\ d \end{smallmatrix}) \text{ and } 
\pi\_p((\begin{smallmatrix} x \\ dp \end{smallmatrix}))= (\begin{smallmatrix} z \\ d \end{smallmatrix}),
$$
where $z$ is the remainder of $x$ divided by $d$.
I guess that $w\_p$ gives rise to a bijection between $S\_1$ and $S\_2$.


I have two questions:


Q1. Are the above formulas correct? If not, what are the correct ones?


Q2. What is the explicit description of $w\_p$? In other words, what are
$$
w\_p((\begin{smallmatrix} x \\ d \end{smallmatrix})) ~\text{ and }~
w\_p((\begin{smallmatrix} x \\ dp \end{smallmatrix}))?
$$


So far, I have tried to compute them
using $\pi\_1 \circ w\_p=\pi\_p$, but I failed. I hope someone can help me to understand this problem.



Degeneracy maps and cusps
Using an explicit description of the Atkin-Lehner involution $w\_p$ as an element $W\_p$ of $M\_2(\mathbb{Z})$ 
(cf. <https://en.wikipedia.org/wiki/Atkin%E2%80%93Lehner_theory>), we may choose
$$
W\_p=\begin{pmatrix} ap & -b \\ Np & p \end{pmatrix},
$$
where $a$ and $b$ are taken so that $ap+bN=1$. (This is possible because $(p, N)=1$.)


Then, we compute  

$$
w\_p \left(\begin{pmatrix} x \\ d \end{pmatrix} \right)
= W\_p \begin{pmatrix} x \\ d \end{pmatrix}
\equiv\begin{pmatrix} a \\ dp \end{pmatrix},
$$
where $a=x$ if $(x, p)=1$ and $a=x+d$ if $d \mid x$. (Here, for two vectors $X$ and $Y$, $X \equiv Y$ means that $X$ and $Y$ represent the same cusp.) Also, 
$$
w\_p \left(\begin{pmatrix} x \\ dp \end{pmatrix} \right)
= W\_p \begin{pmatrix} x \\ dp \end{pmatrix}\equiv \begin{pmatrix} z \\ d \end{pmatrix}.
$$


Moreover, we have
$$
\pi\_1 \left(\begin{pmatrix} x \\ dp \end{pmatrix} \right)=\begin{pmatrix} x \\ dp \end{pmatrix}\equiv \begin{pmatrix} px \\ d \end{pmatrix}\equiv\begin{pmatrix} y \\ d \end{pmatrix}
$$
as cusps on $X\_0(N)$. The equivalence in the middle follows from the fact that $(N, p)=1$.


By this computation, everything is now "coherent".


