If $f(x)=(x-2)q(x)-8$ for polynomial $q$, and $x+2$ is a factor of $f(x)$, find the remainder when $f(x)$ is divided by $x^2-4$ 
Given:
$f(x)=(x-2)q(x) -8$, where $q(x)$ is a polynomial
$(x+2)$ is a factor of $f(x)$
Find the remainder when $f(x)$ is divided by $(x^2-4)$.

I know the answer is $-2x-4$, but I do not know the working behind it?
 A: An easy way: use $\,{ab\bmod ac = a(b\bmod c)} = $ mod Distributive Law to factor out $\,a = x\!+\!2$
$\,\ \color{#0a0}{x\!+\!2\mid f}\,\Rightarrow\, f\bmod x^2\!-\!4\,$ $=\, (x\!+\!2)\underbrace{\Bigg[\color{#0a0}{\dfrac{f}{x\!+\!2}}\bmod x\!-\!\color{#c00}2\Bigg]\! = (x\!+\!2)\left[\dfrac{f(\color{#c00}{2})}{\color{#c00}2\!+\!2}\right]}_{\textstyle\!\!\!\!\! \begin{align} \color{#0a0}f\,\bmod x\!-\!\color{#c00}2\ &=\ f(\color{#c00}{2}) = -8\\ \color{#0a0}{x\!+\!2}\,\bmod x\!-\!\color{#c00}2\ &= \color{#c00}2\!+\!2\end{align}}\! = (x\!+\!2)\left[-2\right]$
Remark $\ $ As I explain in the linked answer, using this distributive law often greatly simplifies computations by reducing the modulus, e.g. above it reduces the modulus to have degree one, viz. $\,x\!-\!2,\,$ and such mods are easy: $\,\color{#0a0}{g(x)}\bmod x\!-\color{#c00}2\!\  =\ g(\color{#c00}2)\,$ by the Polynomial Remainder Theorem. Further this optimization may eliminate the need to use CRT = Chinese Remainder Theorem, so elminates possibly complicated computation of modular inverses.
See this answer for a more complex and general example of the above method for polynomials, which highlights its relationship with Lagrange interpolation and Taylor's formula.
A: We know that when $f(x)$ is divided by $x-2$ the remainder is $-8$, so
$$f(x) = (x-2)q(x) - 8$$
for some polynomial $q(x)$.
We also know that $x+2$ is a factor of of $f(x)$.  This means that when we plug in $x=-2$ to $f(x)$ we should get $0$.  So
$$0 = (-2 -2)q(-2) - 8$$
$$8 = -4q(-2)$$
$$-2 = q(-2)$$
This last result tells us that when $q(x)$ is divided by $x+2$, the remainder is $-2$, so for some polynomial $u(x)$ we have
$$q(x)=(x+2)u(x) - 2$$
Combining these results, we now know that
$$f(x) = (x-2)((x+2)u(x) - 2) - 8$$
$$f(x) = (x^2-4)u(x) -2(x-2) - 8$$
$$f(x) = (x^2 - 4)u(x) -2x - 4$$
and now you can see the remainder when $f(x)$ is divided by $x^2-4$.
