Find the remainder when $p(x)$ is divided by $x^2-a^2$ if $p(x)$ leaves remainders $a, -a$ when divided by $x+a, x-a$ 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]
The other answers give good elementary methods. Here's an approach from abstract algebra.

Assume that the allowable coefficients of $p$ are a field $F$ (e.g., $\mathbb{R}$ or $\mathbb{C}$). Define $S = \{ p \in F[x]: p(\pm a) = \mp a\}$. This set includes every  polynomial of degree $3$ or higher that leaves the required remainders. Define $I = \{ p \in F[x]: p(-a) = p(a) = 0\}$. Note that $S = I - x$ (i.e., adding $x$ to any element of $S$ gives an element of $I$, and vice versa), and that $I$ is an ideal. $F[x]$ is a PID, so $I$ must contain all multiples of some primitive element. Linear primitive elements are easy to rule out, and clearly $x^2 - a^2 \in I$, so $I = \langle x^2 - a^2\rangle$. Thus, every element of $S$ is $-x$ plus a multiple of $x^2 - a^2$, and you're done.

This approach gives an obvious generalization:


  Every polynomial $p(x)$ that satisfies $p(x_1) = y_1, p(x_2) = y_2, \ldots, p(x_n) = y_n$ for some fixed quantities $x_i$ and $y_i$ has the form $p(x) = L(x) + \prod_{i=1}^n (x - x_i)$, where $L(x)$ is the Lagrange interpolation polynomial.