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 ?