<s>[INST] Closed form for summation involving binomial coefficients. how to work following formula 
$$f(n) = (n-1)C(n,n) +(n-2)C(n,n-1) + (n-3)C(n,n-2) + \ldots + (2-1)C(n,2)$$
out to following ?
$$f(n) = (n-2)2^{n-1} + 1$$
 [/INST] Just use the fact that $\sum_{k=0}^n\binom{n}k=2^n$ and the identity $k\binom{n}k=n\binom{n-1}{k-1}$:
$$\begin{align*}
f(n)&=\sum_{k=1}^{n-1}(n-k)\binom{n}{n-k+1}\\
&=\sum_{k=1}^{n-1}k\binom{n}{k+1}\\
&=\sum_{k=2}^n(k-1)\binom{n}k\\
&=\sum_{k=2}^nk\binom{n}k-\sum_{k=2}^n\binom{n}k\\
&=\sum_{k=2}^nn\binom{n-1}{k-1}-\left(2^n-n-1\right)\\
&=n\sum_{k=1}^{n-1}\binom{n-1}k-2^n+n+1\\
&=n\left(2^{n-1}-1\right)-2^n+n+1\\
&=(n-2)2^{n-1}+1
\end{align*}$$
</s>