Total number of integers relatively prime to $p^2$

All positive integers not relatively prime to $p^2$ less than or equal to $p^2$ are of the form $pv$, where $v\leq p$. There are $p$ options for $v$; $v=1,2,3...p$, so of the $p^2$ positive integers less than or equal to $p^2$, $p$ are not relatively prime to it. Then there are $p^2-p$ numbers less than or equal to $p^2$ and relatively prime to $p^2$.

EDIT: In general, $\phi(p^n)=p^n-p^{n-1}$ with similar reasoning.


Let's say $p$ is an odd prime.

You already know this but let's review: from $1$ to $p$, the only number $n$ such that $\gcd(n, p) > 1$ is $n = p$; this is because $p$ is prime and not divisible by any number from $2$ to $p - 1$. From $p + 1$ to $2p$, the only number $n$ such that $\gcd(n, p) > 1$ is $n = 2p$. And so on and so forth to $(p - 1)p + 1$ to $p^2$.

What we've done here is take $p$ sets of $p$ consecutive integers and we've found that in each of these sets only one integer $n$ satisfies $\gcd(n, p) > 1$, meaning that $p - 1$ integers in the set of consecutive integers are coprime to $p$. Since there are $p$ sets of $p$ consecutive integers, that means $(p - 1)p$ integers out of the integers from $1$ to $p^2$ are coprime to $p$ and to $p^2$, just as your book asserted.