If $a \equiv r_i^2 \mod p_i$ for every prime divisor $p_i$ of $b$, then $a$ is a square modulo $b$. Let $a,b,r_i\in \mathbb{Z}$. How to show that if $b$ is squarefree and $a \equiv r_i^2 \mod p_i$ for every prime divisor $p_i$ of $b$, then $a$ is also a square modulo $b$.
Approach: I think I have to use CRT in some way, but I don't see how it follows from that. Can someone explain it to me? Thanks!

$b$ square-free $\Longrightarrow b = \prod_{B\subset\mathbb{P}}b'$ for a finite set of prime numbers $B$.
When $a$ is a perfect square $\pmod{b'}$, for all $b' \in B$, $a$ is a perfect square $\pmod{b}$.
Because $b$ is square free, we know that the prime factors are unique and the exponents in the factorization are all unitary.  If $B$ is the set of divisors of $b$ and $[n]_m = \{n \pmod{m}\} \in \mathbb{Z}/m\mathbb{Z}$, then Chinese Remainder Theorem implies the intersection $\bigcap [a^2]_{b' \in B} = [a^2]_b$, because the residues remain constant as the modulus ranges.
The Dover Edition of Number Theory by Andrews covers this in Chapter 5.
