# unknown polynomial divided by $x^2(x-1)$, find the remainder.

I took an exam today and there's a problem stuck in my head; I still can't figure out yet.

Here's the question (just the concept as I can't remember precisely).

An unknown polynomial divided by $$(x-1)^2$$ leaves the remainder of $$x + 3$$ (not sure about the number) and when this polynomial is divided by $$x^2$$, it leaves $$2x + 4$$ (again, not sure about the number). From the given conditions, if this polynomial is divided by $$(x-1)x^2$$, what would be the remainder?

The solution as far as I figured out is this:

first, from the division of $$(x-1)^2$$, I got that $$f(1) = 3$$ in the same way from division of $$x^2$$, I got $$f(0) = 4.$$

I can write the polynomial as follows:

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

$$ax^2 + bx + c$$ is the remainder. And to find $$a,b,c$$, I can use the conditions above, so I got $$c = 4$$ by substituting $$x = 0,$$ and I got $$a+b+4 = 3$$ by substituting $$x = 1.$$

This leaves $$a + b = -1,$$ and I can't figure out how to continue; please help.

Edit : I made a mistake $$f(1)$$ should be equal to $$4$$ and $$a+b+c = 4$$

• Same as in the variant a couple days ago. – Bill Dubuque Jun 23 at 14:28
• There is a mistake in your approach, you should get $f(1)=1+3=4$ – Julian Mejia Jun 23 at 15:21
• Calculating the two remainders of $f(x) = x^2(x-1)^2h(x) + px^3+qx^2 +rx +s$ and setting them equal to the given remainders gives 4 equations in $p$, $q$, $r$ and $s$. – random Jun 24 at 14:01

We have

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

$$f'(x)=2(x-1)q_1(x)+(x-1)^2q_1'(x)+1$$

Where for $$x=1$$ we have $$f(1)=4$$ and $$f'(1)=1$$

Then from

$$f(x)=x^2q_2(x)+2x+4$$ $$f'(x)=2xq_2(x)+x^2q_2'(x)+2$$

Where for $$x=0$$ we have $$f(0)=4$$ and $$f'(0)=2$$

Now from $$f(x)=x^2(x-1)q_3(x)+ax^2+bx+c$$ and

$$f'(x)=x^2q_3(x)+2x(x-1)q_3(x)+(x-1)x^2q_3'(x)+2ax+b$$

When we substitute the values $$x=0$$ and $$x=1$$ in $$f$$ and $$f'$$ we get

$$f(0)=c=4$$ and $$f(1)=a+b+4=4$$ $$a+b=0$$

$$f'(0)=b=2$$ from this we have $$a=-2$$. Thus the remainder is $$r(x)=-2x^2+2x+4$$

I am going to follow your approach. We have $$f(x)=(x-1)^2p(x)+x+3$$ So, $$f(1)=4$$. We also have that $$f(x)=x^2q(x)+2x+4$$

And we want to find $$a,b,c$$ in $$f(x)=(x-1)x^2g(x)+ax^2+bx+c$$ Plugin $$x=1$$ you get $$4=a+b+c$$.

Plugin $$x=0$$ doesn't give us enough information since this only gives us the remainder after dividing by $$x$$(instead of $$x^2$$).

So, instead of plugin, we look $$f$$ mod $$x^2$$. We have $$f(x)=x^2[(x-1)g(x)+a]+(bx+c)$$ Since we are given that the remainder of dividing $$f(x)$$ by $$x^2$$ is $$2x+4$$, we conclude $$bx+c=2x+4$$, i.e. $$b=2$$, $$c=4$$. And therefore, $$a=-2$$.

We conclude that the reminder of $$f$$ dividing by $$(x-1)x^2$$ is $$-2x^2+2x+4$$.

• Thanks a lot ! but i'm not quite understand about not plugging in x = 0 ,can you explain more? – TAP TAP TAP Jun 23 at 15:45
• @TAP, What I am saying is that plugging in $x=0$ is the same as saying that the remainder of dividing $f$ by $x$ is $c$ and that's why you get $c=4$. Instead, I am saying that the remainder of dividing $f$ by $x^2$ is $bx+c$ and that's why you get $bx+c=2x+4$. You get more information by doing this. So, I am not saying is wrong to plugin, but you lose information. – Julian Mejia Jun 23 at 17:11

$$\ f = \color{#0a0}{3+x + q\cdot (x\!-\!1)^2}\$$ by hypothesis, and also by hypothesis we have

$$\ f = 4\!+\!2x + \color{#c00}g\cdot x^2.\,$$ Put $$\,\color{#c00}{g = a} + \color{#89c}{(x\!-\!1)\,h}\,\$$ ($$=$$ division of $$\,g\,$$ by $$x\!-\!1)\$$ so

$$\bbox[6px,border:1px solid #c00]{ f = 4\!+\!2x + \color{#c00}a\cdot x^2 + x^2\color{#89c}{(x\!-\!1)\,h}}\, =\, \color{#0a0}{3\!+\!x + q\cdot (x\!-\!1)^2}$$

Eval'ed at $$\,x=1\:\Rightarrow\: 4+2+\color{#c00}a+\color{#89c}0\: =\, \color{#0a0}{3\!+\!1 +0}\$$ so $$\ \bbox[6px,border:1px solid #c00]{\color{#c00}{a = -2}}\ \$$ QED

Remark  If you know (Easy) CRT then it immediately yields the general result as below

\begin{align}&f\equiv \color{#c00}a\!\!\!\pmod{\!\color{#c00}g}\\ &f\equiv\color{#0a0}b\!\!\!\pmod{\!x\!-\!1}\end{align}\!\!\!\!\iff\!\! f \equiv a\! +\! g\left[ \dfrac{b\!-\!a}g\bmod x\!-\!1\right]\equiv \color{}a\! +\! \left[ \color{#c00}{\dfrac{\color{#0a0}{b(1)}\!-\!a(1)}{g(1)}}\right] g\ \pmod{(x\!-\!1)g}

\begin{align}&f\,\equiv\, \color{#c00}{4+2x}\!\pmod{\!x^2}\\ &f\,\equiv\,\color{#0a0}{3\,+\,x} \pmod{\!x-1}\end{align}\ \ \ \iff\ \ \ \ f\ \equiv\ \color{}{4 + 2x} \ +\ \ \underbrace{\left[\color{#c00}{\dfrac{\color{#0a0}{3\!+\!1}\!-\!(4\!+\!2)}{1^2} }\right]}_{\Large -2\ \ \ }x^2 \pmod{(x\!-\!1)x^2}

The computation is so easy because we chose $$\,x\!-\!1\,$$ (vs. $$x^2)\,$$ as the modulus in the formula, which simplifies mod arithmetic since $$\,f(x)\bmod x\!-\!1 = \color{#c00}{f(1)}\,$$ by the Polynomial Remainder Theorem. Generally CRT computations are simpler when we solve last the congruences with least moduli.

• If anything above is not clear then please feel welcome to ask questions and I will be happy to elaborate. – Bill Dubuque Jun 23 at 14:43

General method, without the formal derivatives.

Suppose $$f(x) = g(x) (x-1)^2 + (x+3)= h(x) x^2 + (2x + 4).$$ Then $$(x-1)^2 f(x) = (x-1)^2 x^2 h(x) + (x-1)^2 (2x+4) \tag 1$$ and $$x^2 f(x) = x^2 (x-1)^2 g(x) + x^2(x+3). \tag 2$$ Now do the Euclidean algorithm to $$x^2, (x-1)^2$$: \begin{align*} x^2 &= (x-1)^2 + (2x-1), \\ (x-1)^2 &= \frac 14 (2x-1)(2x - 3) + \frac 14, \end{align*} therefore $$1 = 4(x-1)^2 - (2x - 1) (2x-3) = 4(x-1)^2 - (x^2 - (x-1)^2) (2x-3) = (x-1)^2 (4 + 2x-3) - x^2 (2x - 3) = \color{blue}{(x-1)^2 (2x+1) - x^2 (2x - 3)}.$$ Thus $$(2x+1) \cdot \mathrm {Eq}(1) - (2x - 3) \cdot \mathrm {Eq} (2)$$ yields $$f(x) = (x-1)^2 x^2 F(x) + (2x+4) (2x+1)(x-1)^2 - (x+3)(2x-3)x^2.$$ Since $$(2x+4) (2x+1)(x-1)^2 - (x+3)(2x-3)x^2 = (4x^2 + 10x + 4)(x-1)^2 - (2x^2 + 3x -9)x^2 = (4x^3 +6x^2 -6x - 4)(x-1) - ((2x+5)(x-1) -4)x^2 = x^2 (x-1) G(x) + ((-6x -4)(x-1) + 4x^2) = x^2(x-1)G(x) + (\color{red}{-2x^2 +2x +4}),$$ we have $$f(x) = x(x-1)^2 (G(x)+ xF(x)) + (\color{red}{-2x^2 +2x +4}),$$ which means the remainder is $$\color{red}{-2x^2 +2x +4}.$$

• where did F(x) come from ? – TAP TAP TAP Jun 23 at 16:45
• @TAPTAPTAP To be exact, $$F(x) = (2x+1) h(x) - (2x-3)g(x).$$ – xbh Jun 23 at 16:47

Adapting the Extended Euclidean Algorithm, as implemented in this answer, to polynomial division and rotating to go down the page rather than across: $$\begin{array}{c|cc|c} \color{#C00}{x^2}&\color{#C00}{1}&0\\ \color{#090}{x^2-2x+1}&0&\color{#090}{1}\\ 2x-1&1&-1&1\\ \color{#C90}{\frac14}&\color{#C00}{-\frac12x+\frac34}&\color{#090}{\frac12x+\frac14}&\frac12x-\frac34\\ 0&4x^2-8x+4&-4x^2&8x-4 \end{array}\tag1$$ which says $$\overbrace{(2x+1)}^{4\left(\frac12x+\frac14\right)}(x-1)^2+\overbrace{(-2x+3)}^{4\left(-\frac12x+\frac34\right)}x^2=\overbrace{\ \quad1\ \quad}^{4\cdot\frac14}\tag2$$ Therefore (2x+1)(x-1)^2\equiv\left\{\begin{align}1&\pmod{x^2}\\0&\pmod{(x-1)^2}\end{align}\right.\tag3 and (-2x+3)x^2\equiv\left\{\begin{align}0&\pmod{x^2}\\1&\pmod{(x-1)^2}\end{align}\right.\tag4 Thus, mod $$x^2(x-1)^2$$, the polynomial is \begin{align} &(2x+4)\overbrace{(2x+1)(x-1)^2}^{(3)}+(x+3)\overbrace{(-2x+3)x^2}^{(4)}\\ &=2x^4-x^3-3x^2+2x+4\\ &\equiv3x^3-5x^2+2x+4&&\bmod x^2(x-1)^2\\ &\equiv-2x^2+2x+4&&\bmod x^2(x-1)\tag5 \end{align} which we can say since $$\left.x^2(x-1)\,\middle|\,x^2(x-1)^2\right.$$.

$$f(x)\equiv{x+3}\pmod{(x-1)^2}\wedge f(x)\equiv{2x+4}\pmod{x^2} \overset{CRT}{\implies} f(x)\equiv{3x^3 - 5x^2 + 2x + 4}\pmod{(x-1)^2x^2}$$

? chinese(Mod(x+3,(x-1)^2),Mod(2*x+4,x^2))
%1 = Mod(3*x^3 - 5*x^2 + 2*x + 4, x^4 - 2*x^3 + x^2)


Then $$f(x)\equiv{-2x^2 + 2x + 4}\pmod{(x-1)x^2}$$

? Mod(3*x^3 - 5*x^2 + 2*x + 4,(x-1)*x^2)
%2 = Mod(-2*x^2 + 2*x + 4, x^3 - x^2)