Ta có \(2S=2^n+2\cdot2^{n-1}+3\cdot2^{n-2}+...+\left(n-1\right)\cdot2^2+2n\\ \Rightarrow2S-S=2^n+\left(2\cdot2^{n-1}-2^{n-1}\right)+\left(3\cdot2^{n-2}-2\cdot2^{n-2}\right)+...+2n-n\\ \Rightarrow S=2^n+2^{n-1}+2^{n-2}+...+2^2+2-n\\ \Rightarrow S=2\left(2^n-1\right)-n=2^{n+1}-\left(n+2\right)\)
\(S=2^{n-1}+2.2^{n-2}+3.2^{n-3}+...+\left(n-1\right).2+n\)
\(\text{Đặt:}S_n=1.2^{n-1}+2.2^{n-2}+3.2^{n-3}+...+\left(n-1\right).2^1+n\left(1\right)\text{ Với }n\ge1\)
\(\text{Dễ thấy:}S_1=1\)
\(\text{Từ (1) ta có:}\)
\(2S_n+\left(n+1\right)=1.2^n+2.2^{n-1}+3.2^{n-2}+...+\left(n-1\right).2^2+n.2^1+\left(n+1\right)=S_{n+1}\) \(\Rightarrow S_n=2.S_{n-1}+n\)
\(\Leftrightarrow\left(S_n+n+2\right)=2\left(S_{n-1}+\left(n-1\right)+2\right)=2^2\left(S_{n-2}+\left(n-2\right)+2\right)=...=2^{n-1}\left(S_1+\left(1\right)+2\right)=2^{n-1}.4=2^{n+1}\)\(\text{ Do đó ta có:}S_n=2^{n+1}-\left(n+2\right)\)