# Find polynomial with some conditions

I need to find $$f(x)\in \mathbb{Q}[x]$$, such that:

1. $$f(x)\equiv 1 \pmod{(x-1)^2}$$
2. $$f(x)\equiv x \pmod{x^2}$$
3. $$\deg(f(x))<4$$

So, what I understand so far is that:

1. $$(x-1)^2\mid f(x)-1$$
2. $$x^2\mid f(x)-x$$
(I hope I'm right at those)

But I'm stuck here, I don't know how to continue...

Thank you!

Let the polynomial be $$f(x)=ax^3+bx^2+cx+d$$. The second condition is easier to apply, because it implies $$c=1$$ and $$d=0$$.

Now let's apply the first condition. You know that $$f(1)-1=0$$, so $$a+b+1-1=0$$ On the other hand, $$1$$ must also be a root of the derivative of $$g(x)=f(x)-1$$. Hence $$3a+2b+1=0$$ Thus $$a=-1$$ and $$b=1$$.

The polynomial is $$f(x)=-x^3+x^2+x$$.

Without derivatives: consider $$g(x)=f(x)-1=ax^3+bx^2+x-1$$. It should be divisible by $$x-1$$, so $$g(1)=a+b+1-1=0$$. Hence $$b=-a$$. Now we see that $$g(x)=ax^3-ax^2+x-1=ax^2(x-1)+(x-1)=(x-1)(ax^2+1)$$ This should be divisible by $$(x-1)^2$$, yielding $$a=-1$$.

• Worth emphasis: we can avoid the need to solve systems of equations (or use derivatives) by instead using an operational form of CRT, which uses only trivial mental arithmetic - see my answer. – Bill Dubuque Jul 23 at 15:13
• I nee dto do it without derivative ... :( – CS1 Jul 24 at 19:45
• @CS1 Just do division, then. – egreg Jul 24 at 20:09
• @egreg division of what? Thank you! – CS1 Jul 24 at 20:16
• @CS1 I added the argument. – egreg Jul 24 at 20:43

$$f(x)-1=g(x-1)^2$$ with $$g$$ that is a polynomial of degree $$1$$, so $$g=ax+b$$ but you have also that

$$f(x)-x=(cx+d)x^2$$

so

$$(ax+b)(x-1)^2+1=(cx+d)x^2+x$$

Then $$a=c$$, $$-2a+b=d$$, $$a-2b=1$$, $$b+1=0$$

so

$$b=-1$$, $$a=-1$$, $$d=1$$, $$c=-1$$.

Then

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

$$-(1+x)(x-1)^{2}+1$$ is such a polynomial.

• This is correct, but will likely mystify beginners. It can be derived very simply using the modular distributive law - see my answer. – Bill Dubuque Jul 23 at 15:22

Using $$\ ag\,\bmod\, bg\, =\, g\,\left[\,a\bmod b\,\right]\:$$ to factor out $$\: g = (x\!-\!1)^{\large 2}$$ \,\ \begin{align}f\!-\!1\!\!\!\pmod{\!x^{\large 2} g} &\,=\, g\,\left[\dfrac{\!\color{#c00}f\!-\!1\,}{(x\!-\!1)^{\large 2}}\bmod {x^{\large 2}}\right]^{\phantom{|^|}}\!\!,\, \ {\rm so}\ \ \color{#c00}{f\equiv x}\!\!\!\pmod{\!x^2}\ \ \rm yields\\ &\!\!\!=\ {-}g\,\left[\,\color{#0a0}{x\!+\!1}\,\right]\ \ {\rm by}\ \ \dfrac{\color{#c00}x\!-\!1\ }{(x\!-\!1)^{\large 2}} \equiv \dfrac{1}{x\!-\!1} \equiv \dfrac{1\!-\!\color{#90f}{x^{\large 2}}}{x\!-\!1} \equiv \color{#0a0}{-(x\!+\!1)}\!\!\pmod{\!\color{#90f}{x^{\large 2}}} \end{align}

Consider the polynomial $$f(x)=(Ax+B)(x-1)^2+1$$. It is evident that $$f$$ satisfies the conditions 1 and 3. It remains to find $$A$$ and $$B$$ such that $$f(x)=(Ax+B)(x^2-2x+1)+1\equiv (A-2B)x+B+1\equiv x \pmod{x^2}$$ that is $$B=-1$$ and $$A=-1$$. Hence $$f(x)=-(x+1)(x-1)^2+1=-x^3+x^2+x.$$

• Dear downvoter, a comment will help me to improve my answer. – Robert Z Jul 23 at 18:05
• @CS1 I edited my answer, is it clear now? – Robert Z Jul 25 at 4:41