Let $n \geqslant 2$ give the remainder of the Euclidean division of $X^{n}-X^{n-1}+1$ by $X^{2}-3 X+2$
By definition, the Euclidean division is of the form $X^{n}-X^{n-1}+1=\left(X^{2}-3 X+2\right) Q(X)+$ $R(X)$ with $R(X)=a X+b$.

We note that $\left(X^{2}-3 X+2\right)=(X-2)(X-1)$, by evaluating at 1, we have: $1=a+b$ and by evaluating at 2, we have $2^{n-1}+1=2 a+b$.

Thus, $a=2^{n-1}$ and $b=1-2^{n-1}$.

Thus $R(X)=2^{n-1} X+\left(1-2^{n-1}\right)$.