The answer is 43.

**
This section requires Javascript.
**

You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.

We can write,

$f(x) = g(x)(x-1)^2 + 2x + 1$

$f(x) = g(x)(x-1)^2 + 2(x-1) + 3$

$f(x) - 3 = (x-1)(g(x)(x-1) + 2)$

$\dfrac{f(x) - 3}{x-1} = g(x)(x-1) + 2$

Now, let $\dfrac{f(x) - 3}{x-1} = F(x)$

Then $F(x) = g(x)(x-1) + 2$

and $F(1) = 2$

Now, by remainder-factor theorem,

$f(3) = 15$

$\Rightarrow F(3) = \dfrac{f(3) - 3}{3-1} = 6$

Now, let the remainder when $F(x)$ is divided by $(x-1)(x-3)$ be $R(x) = ax + b$

Then, $R(1) = a + b = 2$

And $R(3) = 3a + b = 6$

Whose solution is $a = 2, b =0$

Therefore $R(x) = 2x$

And $F(x) = G(x)(x-1)(x-3) + 2x$

$\dfrac{f(x) - 3}{x-1} = G(x)(x-1)(x-3) + 2x$

$f(x) - 3 = G(x)(x-1)^2(x-3) + 2x^2 - 2x$

$f(x) = G(x)(x-1)^2(x-3) + 2x^2 - 2x + 3$

Therefore $r(x) = 2x^2 - 2x + 3$

And $r(5) = 2 *5^2 - 2*5 + 3 = \boxed{43}$