Prove that the polynomial $f_n(x)=nx^{n+1}-(n+1)x^n+1$ is divisible by $(x-1)^2$ Prove that the polynomial $f_n(x)=nx^{n+1}-(n+1)x^n+1$ is divisible by $(x-1)^2$  where $n\in\Bbb{N_1}$.
My Attempt


*

*I've tried proving it by induction but can't find a way to prove it
for $n+1$ after assuming it holds for $n$;

*I've also checked it graphically, it seems that for all $n$ $f_n$
intersects the axes at $(0,1)$ and $(1,0)$;

*I've also tried finding a factor $k$ such that $(x-1)^2k=f_n(x)$ for
$n=3, n=4$ on WA but with no luck.
 A: Hint: A polynomial $p(x)$ has $(x-a)^n$ has a factor iff $p(a)=p'(a)=\cdots = p^{(n-1)}(a)=0$
...or

 Consider $(1-x)^2(1+2x+3x^2+\cdots+nx^{n-1})$

A: Note that $$\left(nx^{n+1}-(n+1)x^n+1\right)-\left((n-1)x^n-nx^{n-1}+1\right)=nx^{n-1}(x^2-2x+1)$$and you should get an induction to work
A: Hint:
$$
\begin{align}
nx^{n+1}-(n+1)x^n+1 & = nx^n(x-1) - (x^{n}-1) \\
 &= (x-1)\big(n x^n- x^{n-1}-x^{n-2}- \cdots -1\big) \\
 &= (x-1)\big((x^n-x^{n-1})+(x^n-x^{n-2})+\cdots+(x^n-1)\big) = \cdots
\end{align}
$$
A: Here is a nice answer, from a surprising direction.
Consider a geometric series with $a_1=1$ and $q$ is an integer.$$1+q+q^2+...+q^{n}=\frac{q^{n+1}-1}{q-1}\\0+1+2q+3q^2+...+nq^{n-1}=(1+q+q^2+...+q^n)'=(\frac{q^{n+1}-1}{q-1})'=\\=\frac{q^{n+1}-1-(n+1)q^n(q-1)}{(q-1)^2}=\frac{q^{n+1}-1-nq^{n+1}-q^{n+1}+(n+1)q^n}{(q-1)^2}=\\=-\frac{nq^{n+1}-(n+1)q^n+1}{(q-1)^2}$$
Well, from the definition of this sum, it must be an integer!
A: Prove that both $f$ and $f'$ is divisible by $(x-1)$
In addition you can factorize it
$nx^n(x-1)-x^n+1=(x-1)Q(x)$
in which $Q(1)=0$
A: $f(1)=n-(n+1)+1=0$
$f'(1)=n(n+1)-n(n+1)=0$
Hence $(x-1)^2$ is a root of $f(x)$
A: Use induction. Clearly the result is true for $n = 1$. Suppose that $(x-1)^2$ divides $f_n(x)$ for some integer $n \geq 1$. Using polynomial long division we find that
$$
\frac{f_{n+1}(x)}{(x - 1)^2} = (n+1)x^n + \frac{f_n(x)}{(x-1)^2}
$$
Since by the induction hypothesis $f_n(x) = (x-1)^2q(x)$ for some polynomial $q(x)$, it follows that
$$
\frac{f_{n+1}(x)}{(x - 1)^2} = (n+1)x^n + q(x)
$$
and hence $(x-1)^2$ divides $f_{n+1}(x)$.
