Polynomial Counting – How to Determine the Number of Polynomials P(x) of Degree Not Exceeding 3?

combinatoricslinear algebrapolynomials

How many polynomials $P(x)$ of degree not exceeding 3 are there such that each coefficient is a non-negative integer less than 10, and that $P(-1)=-9$?

My attempt:There would be one linear polynomial i.e. $9x=0$

Edit:Let the quadratic equations be of the form $ax^2+bx+c=0$ then the required condition would be $a+c-b=-9$ but minimum possible value of $a+cl-b$ is $-8$ so there would be no such quadratic equations.

Now, let the cubic polynomial be of the form $ax^3+bx^2+cx+d$ then we need such cubics which satisfy this condition:
$-(a+c)+b+d=9\\i.e. b+d=9+a+c$
Now $a$ can be anything between 1 and 9 while $\text{b,c and d}$ can be anything between 0 to 9.
Now, maximum value of $b+d$ would be 18. So,the above condition would reduce to $18-9=9=a+d$ with the condition that both $\text{a and b}$ are non negative integers less than 10 and $a$ can not be equal to zero. Using, combinatorics it can be easily found that number of solutions of this equation is $\binom{9}1=9$.

Second largest value of $b+d$ would be 17.Thus, giving the condition $a+c=8$ which has 8 solutions. Besides,$b+d=17$ can be written in $2$ ways. So, total number of solutions is equal to $8.2=16$.
Continuing further similarly we get,

$a+c=7=> \text{Number of solutions}=7.3=21\\ a+c=6=> \text{Number of solutions}=6.4=24\\a+c=5=> \text{Number of solutions}=5.5=25\\a+c=4=> \text{Number of solutions}=4.6=24\\a+c=3=> \text{Number of solutions}=3.7=21\\a+c=2=> \text{Number of solutions}=2.8=16\\a+c=1=> \text{Number of solutions}=1.9=9$

Adding all these should give answer. But their sum is 166 which is the wrong answer.

Correct answer: $\binom{12}3=220$

What am I doing wrong?

Best Answer

$$(b-a)+(d-c)=9$$
Imagine a line with 9 red balls and 3 green balls. Consider the following example, enter image description here The number of red balls from the start till the first green ball gives you the value for $a$.
The number of red balls from the start till the second green ball gives you the value for $b-a$.

The number of red balls from the second green ball till the third green ball gives you the value for $c$. The number of red balls from the second green ball till the end gives you the value for $d-c$.

This has $\binom{12}3=220$ solutions