I was trying to solve the equality $a^2+b^2=1$ in $\mathbb{Z}_p$, the $p$-adic integers.
If $p =1$ mod $4$ then $\mathbb{Z}_p$ admits an element $i$ such that $i^2=-1$, using this we can define two functions \begin{equation} cos(x)=\frac{e^{ix}+e^{-ix}}{2} \quad sin(x)=\frac{e^{ix}-e^{-ix}}{2i} \end{equation} exactly as in the case of complex numbers and show they include all the solutions to the above equation.
If $p=2$ then by considering the equality modulo $4$ it is easy to see that one between $a,b$ must be a unit and the other must be divisible by $4$, say $b=4x$. Then we have $a=\pm\sqrt{1-16x^2}$ and we can express this using the power series \begin{equation} (1+z)^{\alpha}=\sum_{k=0}^{\infty}\binom{\alpha}{k}\frac{z^k}{k!} \end{equation} by taking $\alpha=1/2$, since $z=-16x^2$ we have convergence.
I have a problem with the case $p=3$ mod $4$. In this situation we do not have a square root of $-1$ so we cannot define $cos$ and $sin$ as for the first case. Moreover we do not have necessarily that one between $a$ and $b$ must be divisible by $p$, therefore the argument I proposed for $p=2$ cannot be repeated.
Do you have an idea of how to present all the possible solutions of this equation in the remaining case?
Here’s an answer that is probably in perfect equivalence to that of Torsten, but rather more elementary.
Why not use the well-known formulas, \begin{align} a&=\frac{2t}{t^2+1}\\ b&=\frac{t^2-1}{t^2+1}\, \end{align} You can derive them for yourself by taking the line through $(0,-1)$ with slope $t$ and finding its other intersection with the circle. You catch all points on the circle but $(0,1)$.
I think it’s shameful that this parametrization is not routinely shown to students in first-year Calculus.
EDIT, Addendum:
You’ve asked in a comment how to know that the parametrization catches all points on the curve $X^2+Y^2=1$. Take one such, say $P=$ your point $(a,b)$. Draw the line ($Y=\mu X+\beta$) between $(0,-1)$ and $P$. It’s immediate that $\beta=-1$ and $\mu=\frac{b+1}a$.
But now you’re done, subject to the verification that when you substitute $\mu$ for $t $ in the formulas, you do in fact get $a$ and $b$. I won’t insult you by doing the algebra for you—just don’t forget that $a^2+b^2=1$ at the crucial point in the computation.