# The sum of the coefficients of $x^3$ in $(1-\frac{x}{2}+\frac{1}{\sqrt x})^8$

I know how to solve such questions when it's like $(x+y)^n$ but I'm not sure about this one:

In $(1-\frac{x}{2}+\frac{1}{\sqrt x})^8$, What's the sum of the coefficients of $x^3$?

-
Why don't you treat $(1-1/\sqrt{8})$ as $y$ and $-x/2$ as $x$? –  Eelvex Feb 15 '12 at 20:43
@Eelvex: I made a mistake while typing the question, sorry. –  Gigili Feb 15 '12 at 20:47

My answer does not differ in substance from the others, but I thought that you might like one that doesn’t appeal explicitly to multinomials.

You can avoid fractional exponents by substituting $y=\sqrt x$ and asking for the coefficient of $y^6$ in $$\left(1-\frac{y^2}2+\frac1y\right)^8\;;$$ this is thoroughly unnecessary, but it makes the typing a little easier, so I’m going to do it.

The terms of this power are all of the form $$1^i\left(-\frac{y^2}2\right)^j\left(\frac1y\right)^k\;,\tag{1}$$ where $i+j+k=8$. The exponent on $y$ in $(1)$ is $2j-k$, so you want the terms in which $2j-k=6$. Clearly these can occur only with even $k$. If $k=0$, $j=3$ and $i=5$; if $k=2$, $j=4$ and $i=2$; if $k\ge 4$, $j\ge 5$ and $j+k>8$, which is impossible. The only possibilities, then, are terms of the forms $$1^5\left(-\frac{y^2}2\right)^3\left(\frac1y\right)^0=-\frac18y^6\tag{2}$$ and $$1^2\left(-\frac{y^2}2\right)^4\left(\frac1y\right)^2=\frac1{16}y^6\;.\tag{3}$$ It only remains to determine how many times each of these terms appears in the expansion. For $(2)$ there are $\binom83=56$ ways to choose from which three of the eight factors the $-\frac{y^2}2$ is taken, and once that’s decided, everything else is determined. For $(3)$ there are $\binom84=70$ ways to choose from which four factors the $-\frac{y^2}2$ is taken, and for each of those there are $\binom42=6$ ways to decide from which of the remaining two factors the $1$ is taken. The total coefficient of $y^6$ is therefore $$56\left(-\frac18\right)+70\cdot 6\left(\frac1{16}\right)=\frac{210-56}8=\frac{77}4$$ (assuming that I’ve not loused up the arithmetic at some point).

-
That was perfect, thank you. –  Gigili Feb 15 '12 at 21:36

\begin{align} \left(\frac1{\sqrt{x}}+1-\frac12x\right)^8 &=\sum_{k=0}^8\binom{8}{k}\left(\frac1{\sqrt{x}}\right)^k\left(1-\frac12x\right)^{8-k}\\ &=\color{#00A000}{\sum_{k=0}^4\binom{8}{2k}\left(\frac1x\right)^k\left(1-\frac12x\right)^{8-2k}}\\ &+\color{#C00000}{\frac1{\sqrt{x}}\sum_{k=0}^3\binom{8}{2k+1}\left(\frac1x\right)^k\left(1-\frac12x\right)^{7-2k}}\tag{1} \end{align} The terms from the red part of $(1)$ will all have fractional powers of $x$ in them, so we only need to consider the green part of $(1)$. Furthermore, for each $k$, the highest power of $x$ in the green part is $8-3k$. Therefore, we only need to consider $k=0$ and $k=1$.

For $k=0$, the term in the green sum is $\left(1-\frac12x\right)^8$ and the coefficient of $x^3$ there is $\binom{8}{3}\left(-\frac12\right)^3$.

For $k=1$, the term in the green sum is $\binom{8}{2}\frac1x\left(1-\frac12x\right)^6$ and the coefficient of $x^3$ there is $\binom{8}{2}$ times the coefficient of $x^4$ in $\left(1-\frac12x\right)^6$, which is $\binom{8}{2}\binom{6}{4}\left(-\frac12\right)^4$.

Therefore, the coefficient of $x^3$ in $\left(\frac1{\sqrt{x}}+1-\frac12x\right)^8$ is $\binom{8}{3}\left(-\frac12\right)^3+\binom{8}{2}\binom{6}{4}\left(-\frac12\right)^4=\frac{77}{4}$.

-
Now that I look closer, the idea is pretty close to Brian Scott's answer. –  robjohn Sep 24 '12 at 23:19

The formula you're looking for is $$(x+y+z)^8 = \sum_{i+j+k = 8} \begin{pmatrix} 8 \\\ i,j,k \end{pmatrix} x^i y^j z^k$$ with $$\begin{pmatrix} 8 \\\ i,j,k \end{pmatrix} = \frac{8!}{i!j!k!}.$$ This is known as the multinomial expansion (it works for more than $3$ variables too, you just have to add more indices and modify the multinomial coefficient accordingly). Using this, then you find when does $x^3$ appear in the expansion $$\left( 1 + \left( \frac {-x}2 \right) + \frac 1{\sqrt x} \right)^8 = \sum_{i+j+k = 8} \begin{pmatrix} 8 \\\ i,j,k \end{pmatrix} (-x/2)^j (1/\sqrt{x})^k$$ In this case we must have $j-(k/2) = 3$, which means $2j-k = 6$, and $0 \le i,j,k \le 8$, or we can rewrite this as $0 \le j \le 8$, $k = 2j-6$ and $i = 8-j-k$. This leaves the cases $(5,3,0)$ and $(2,4,2)$. Computing, the coefficient in front of $x^3$ is $$\begin{pmatrix} 8 \\\ 5,3,0 \end{pmatrix} (-1/2)^3 + \begin{pmatrix} 8 \\\ 2,4,2 \end{pmatrix} (-1/2)^4 = 77/4.$$ (I got the $77/4$ using WolframAlpha and/or a calculator, no magic there.)

Hope that helps,

-
Thank you Patrick, I accepted Brian's answer as it made it clearer. +1 anyway. –  Gigili Feb 16 '12 at 13:44

The multinomial expansion gives $\mathbf{S}= (1 - \frac{x}{2} + \frac{1}{\sqrt{x}})^8 = \sum_{k_1+k_2 +k_3=8} \binom{8}{k_1,k_2,k_3} (1)^{k_1}(\frac{-x}{2})^{k_2} (\frac{1}{\sqrt{x}})^{k_3}.$ Simplifying we get $\mathbf{S}=\sum_{k_1+k_2 +k_3=8} \binom{8}{k_1,k_2,k_3} (\frac{-1}{2})^{k_2} (x)^{k_2 -k_3/2}.$ Now identify the tuples for which $(k_1,k_2,k_3) \in \mathbb{Z}_{+}^{3}$ such that $k_1+k_2+k_3=8$ and $k_2-k_3/2=3.$ Then add the coefficients for these tuples to get your answer.

-

You can just multiply it out. Alternatively, you can reason the terms are of the form $1^a(\frac x2)^b(\frac 1{\sqrt x})^c$ with $a+b+c=8, b-\frac c2=3$. Then $c=2b-6$, so $a+3b=14$ and $a$ needs to be $2 \text{ or } 5$. Then you need the multinomial coefficient as stated by Suresh.

-
If $a = 8$ you don't have a coefficient of $x^3$... –  Patrick Da Silva Feb 15 '12 at 21:05
@PatrickDaSilva: You do if b=2, c=-2. But that isn't part of the product, you are right. Fixed. –  Ross Millikan Feb 15 '12 at 21:22
Things happen. Heh =) –  Patrick Da Silva Feb 15 '12 at 21:29