Let $a\neq0$ and $p(x)$ be a polynomial of degree greater than $2$. If $p(x)$ leaves remainders $a$ and $-a$ when divided respectively by $x+a$ and $x-a$. Find the remainder when $p(x)$ is divided by $x^2-a^2$
$$ p(x)=q(x).(x+a)+r_1=q(x).(x+a)+a\quad\big[r_1=p(-a)=a\big]\\ p(x)=s(x).(x-a)+r_2=s(x).(x-a)-a\quad\big[r_2=p(a)=-a\big]\\ p(x)=t(x).(x^2-a^2)+r=t(x).(x^2-a^2)+Ax+B\\ p(a)=aA+B=-a\\ p(-a)=-aA+B=a\\ B=0,\;A=-1\implies r=Ax+B=-x $$ I was wondering Is there another way to solve this problem ?
Hint $\ \overbrace{ x\!-\!a,x\!+\!a\,\mid\, p\!+\!x\!}^{\large p(a)+a\ =\ 0\ =\ p(-a)-a\!\!\!\!\!}\!\iff\! (x\!-\!a)(x\!+\!a)\mid p\!+\!x\,$ over a field where $\,\color{#c00}{2a\neq 0}$
since then we have the Bezout GCD equation $\ x+a - (x-a)\, =\, \color{#c00}{2a}$
which implies that $\,x\!+\!a,\, x\!-\!a\,$ are coprime, so their lcm = product.
Alternatively, $ $ apply: $\ fg\bmod fh = f(g\bmod h) = $ mod Distributive Law (a form of CRT)
$x\pm a\mid p\!+\!x\,\Rightarrow\, p\!+\!x\bmod x^2\!-\!a^2 = (x\!-\!a)\left[\dfrac{p\!+\!x}{x\!-\!a}\bmod x\!+\!a\right] = (x\!-\!a)[0] = 0$
There are two of many ways to solve CCRT = Constant-case of CRT [Chinese Remainder Theorem]