By the binomial theorem, the [tex]x^2[/tex] term in the expansion of [tex]\left(1-\frac x4\right)^n[/tex] is
[tex]\dbinom n21^{n-2}\left(-\dfracx4\right)^2=\dfrac{n!}{2!(n-2)!}\dfrac{x^2}{16}[/tex]
which suggests that the contribution of the binomial coefficient should make up the remaining factor of 21. That is,
[tex]\dfrac{n!}{2!(n-2)!}=\dfrac{n(n-1)}2=21\implies n=7[/tex]