I am trying to compute the following sum \begin{align} S = \sum_{k = 1}^{n} \dfrac{k}{2^k} \end{align} I have computed this sum and found that $$ \bbox[5px,border:2px solid red] { S = 2 - \dfrac{n+2}{2^{n}} } $$ For prooving this let's rewrite the sum in the following way: \begin{align} S = \dfrac{1}{2} + \dfrac{1 + 1}{2^2} + \dfrac{1+1+1}{2^3} + \ldots + \dfrac{1+ \ldots+1}{2^n} = \bbox[5px,border:2px solid yellow] {\dfrac{1}{2} + \dfrac{1}{2^2} + \ldots + \dfrac{1}{2^n}} + \bbox[5px,border:2px solid yellow] { \dfrac{1}{2^2} + \dfrac{1}{2^3} + \ldots+\dfrac{1}{2^n}} + \ldots + \bbox[5px,border:2px solid yellow]{ \sum_{j = k}^{n}\dfrac{1}{2^j}} + \ldots +\bbox[5px,border:2px solid yellow]{ \dfrac{1}{2^n}} = \sum_{j = 1}^{n}\left( \dfrac{1}{2^{k-1}} - \dfrac{1}{2^n} \right) = 2 - \dfrac{1}{2^{n-1}} - \dfrac{n}{2^n} =2 - \dfrac{n+2}{2^{n}} \end{align} This computations are rather awfull and i made them just to find the answer, and i am looking for another interesting ways how to compute this sum (especcialy not elementary, using calculus, or number theory, or theory of functions of complex variable, or something else), any ways will be very appriciated!
-
https://math.stackexchange.com/questions/1196452/expected-value-of-the-number-of-flips-until-the-first-head/1196478#1196478 – JMoravitz Jul 20 '21 at 17:02
-
4Hint: take the derivative of both sides of $\sum_{k=1}^n x^k = (x^{k+1}-x)/(x-1)$ and plug in $x=\frac12$. – Greg Martin Jul 20 '21 at 17:02
-
Compare https://math.stackexchange.com/q/1155422/42969 or https://math.stackexchange.com/a/30741/42969. – Martin R Jul 20 '21 at 17:04
-
1Also see this for a more general cases: https://math.stackexchange.com/a/4132096/752069 – VIVID Jul 20 '21 at 18:11
-
Notice that $(x^k)'=kx^{k-1}$ so when you see $\sum k,x^k$ (here $x=\frac 12$) it can be obtained by differentation of $f(x)=\sum x^k$ which is known. Similarly for any power of $k$ and by extension any polynomial $\sum P(k)x^k$ can be obtained using higher derivatives of $f$. (see the linked posts for details). – zwim Jul 20 '21 at 18:28
2 Answers
First, compute the value of a geometric series $$ T_n = \sum_{k=1}^n (1/2)^k . \tag1$$ We can multiply by $1/2$ to get $$ \frac{1}{2} T_n = \sum_{k=1}^n (1/2)^{k+1} = \sum_{k=2}^{n+1} (1/2)^k \tag2$$ Compute $(1) - (2)$: $$ T_n - \frac{1}{2}T_n = \sum_{k=1}^{n} (1/2)^k- \sum_{k=2}^{n+1} (1/2)^k \\ \frac{1}{2} T_n = (1/2) - (1/2)^{n+1} $$ so $$ T_n = 1 - (1/2)^{n} \tag3$$
Now let's go on to compute
$$
S_n = \sum_{k=0}^n k (1/2)^k
\tag4$$
(Starting at $k=0$ makes no difference.)
As before, multiply by $1/2$
$$
\frac{1}{2} S_n = \sum_{k=0}^n k (1/2)^{k+1} = \sum_{k=1}^{n+1} (k-1) (1/2)^k
\tag5$$
Subtract $(4)-(5)$
$$
S_n - \frac{1}{2} S_n = \sum_{k=0}^n k (1/2)^k - \sum_{k=1}^{n+1} (k-1) (1/2)^k
\\
\frac{1}{2} S_n = 0 + \sum_{k=1}^n (1/2)^k - n(1/2)^{n+1}
\\
\frac{1}{2} S_n = 0 + T_n - n(1/2)^{n+1}
\\
\frac{1}{2} S_n = 0 + 1-(1/2)^n - n(1/2)^{n+1}
$$
so
$$
S_n = 2 -(2+n)(1/2)^n
$$

- 111,679
Here is a generating function approach. We use the coefficient of operator $[z^n]$ to denote the coefficient of $z^n$ of a series.
We obtain \begin{align*} \color{blue}{\sum_{k=1}^n}\color{blue}{\frac{k}{2^k}} &=[z^n]\sum_{q=0}^{\infty}\left(\sum_{k=0}^q\frac{k}{2^k}\right)z^q\tag{1}\\ &=[z^n]\frac{1}{1-z}\,\sum_{q=0}^\infty \frac{q}{2^ q}z^q\tag{2}\\ &=[z^n]\frac{z}{1-z}\,\frac{d}{dz}\sum_{q=0}^\infty \left(\frac{z}{2}\right)^q\\ &=[z^{n-1}]\frac{1}{1-z}\,\frac{d}{dz}\left(\frac{1}{1-\frac{z}{2}}\right)\tag{3}\\ &=\frac{1}{2}[z^{n-1}]\frac{1}{1-z}\,\frac{1}{\left(1-\frac{z}{2}\right)^2}\\ &=[z^{n-1}]\left(\frac{2}{1-z}-\frac{1}{1-\frac{z}{2}}-\frac{1}{2\left(1-\frac{z}{2}\right)^2}\right)\tag{4}\\ &=[z^{n-1}]\left(2\sum_{j=0}^\infty z^j-\sum_{j=0}^\infty \left(\frac{z}{2}\right)^j\right.\\ &\qquad\qquad\qquad\left.-\frac{1}{2}\sum_{j=0}^\infty(j+1)\left(\frac{z}{2}\right)^j\right)\\ &=2-\frac{1}{2^{n-1}}-\frac{n}{2^n}\tag{5}\\ &\,\,\color{blue}{=2-\frac{n+2}{2^n}} \end{align*} in accordance with OPs result.
Comment:
In (1) we write the sum as coefficient of $z^n$ of a generating function.
In (2) we use that multiplication with $\frac{1}{1-z}$ transforms a coefficient $a_q$ to the sum of the first $q$ coefficients: $\sum_{k=0}^q a_k$.
In (3) we apply the rule $[z^p]z^qA(z)=[z^{p-q}]A(z)$ and use the differential operator $\frac{d}{dz}$.
In (4) we make a partial fraction expansion to ease the following series expansion.
In (5) we select the coefficient of $z^{n-1}$.
Btw. I think OPs approach is smart. Using sigma notation it can be written as
\begin{align*} \color{blue}{\sum_{k=1}^n}\color{blue}{\frac{k}{2^k}} &=\sum_{k=1}^n\frac{1}{2^k}\sum_{j=1}^k1\\ &=\sum_{j=1}^n\sum_{k=j}^n\frac{1}{2^k}\\ &=\sum_{j=1}^n\left(\frac{1-\frac{1}{2^{n+1}}}{1-\frac{1}{2}}-\frac{1-\frac{1}{2^j}}{1-\frac{1}{2}}\right)\\ &=\sum_{j=1}^n\left(\frac{1}{2^{j-1}}-\frac{1}{2^n}\right)\\ &=\frac{1-\frac{1}{2^n}}{1-\frac{1}{2}}-\frac{n}{2^n}\\ &\,\,\color{blue}{=2-\frac{n+2}{2^n}} \end{align*}

- 108,315
-
Looks very nice! One question - (just because of my very poor knowledge of english) i understand right from the context that $[z^n]$ is an operator that acts on formal series $\sum_{k = 1}^{\infty} a_k z^k$ the following way - $[z^n](\sum_{k = 1}^{\infty} a_k z^k) = a_n$? – NeoFanatic Jul 24 '21 at 13:22
-
@NeoFanatic: Yes, that is correct. You might want to look at this post for a reference regarding this operator. – Markus Scheuer Jul 24 '21 at 13:34