I am hoping to get a feedback on my solution to the following problem and if there are better solutions I would love to take a look. Thank you for your time.
Let $f(x)$ be a polynomial with remainders $A$ and $B$ when divided by $x-a$ and $x-b$ respectively, where $a\not=b$. What’s the remainder when $f(x)$ is divided by $(x-a)(x-b)$?
My solution: $$f(x)=(x-a)g(x)+A$$ And so $$(x-b)f(x)=(x-a)(x-b)g(x)+A(x-b)\;\;\;(1)$$
On the other hand, $$f(x)=(x-a)(x-b)s(x)+c(x)$$
And so $$xf(x)=(x-a)(x-b)xs(x)+xc(x)\;\;\;\;(2)$$
Subtracting the first expression from the second,
$$bf(x)=(x-a)(x-b)(xs(x)-g(x))+xc(x)-A(x-b)$$
Moreover, if we let $f(x)=(x-b)h(x)+B$, we have in a similar manner, $$af(x)=(x-a)(x-b)(xs(x)-h(x))+xc(x)-B(x-a)$$
Hence,
$$(b-a)f(x)=(x-a)(x-b)(h(x)-g(x))+B(x-a)-A(x-b)$$
Therefore,
$$f(x)=(x-a)(x-b)\dfrac{(h(x)-g(x))}{(b-a)}+\dfrac{B(x-a)-A(x-b)}{b-a}$$
And so the second term is the remainder.
Here is a simpler approach: $$ f(x)=(x-a)(x-b)q(x)+ux+v $$ Then $$ A = f(a) = ua + v, \quad B = f(b) = ub + v $$ gives a linear system for $u,v$ whose solution is $$ u = \frac{A-B}{a-b}, \quad v = \frac{a B -A b}{a-b} $$