5. Given $a \neq b$, the remainder when polynomial $f(x)$ is divided by $x-a$ and $x-b$ are $c$ and $d$, respectively. Find the remainder when $f(x)$ is divided by $(x-a)(x-b)$.
5. Let $f(x)=(x-a)(x-b) \cdot g(x)+m x+n$. By the Remainder Theorem, we know $f(a)=c, f(b)=d$, i.e., $m a + n=c, m b+n=d$. Solving these, we get $m=\frac{c-d}{a-b}, n=\frac{a d-b c}{a-b}$. Therefore, the required remainder is $\frac{c-d}{a-b} x+\frac{a d-b c}{a-b}$.