How can I prove the concavity of $f(p_1,p_2,\ldots,p_n) = \sum_{i = 1}^n p_i(1-p_i)$? Assume $p_n$ is the probability of being in class $n$ 
which mean that $f(0) = 0$ , $f(1) =0$ , and  $p_1+p_2 = 1$
I need to come up with a concave function that show the relation between $p_1$ and $p_2$
The function $f(p) = p(1-p)$ is a concave function. It's easily to proof its concave by $f''(x) <0 $
But after I generalized with $p_n$,
how can I prove the concavity of $$f(p_1,p_2,\ldots,p_n) = \sum_{i = 1}^n p_i(1-p_i)$$
What is the best way to prove a function (with several variables) is a concave function?
 A: In this particular example, there's no need for tedious computation.
Fact: The sum of convex (concave) functions is always convex (concave). Fact: The composition of a convex (concave) function with an affine map is convex (concave).
Let
$$f_i(p_1, \ldots, p_n) = p_i(1-p_i),$$
this is concave (though not strictly concave) because it's a composition of the concave function $h(x) = x(1-x)$ with the affine function $(p_1, \ldots, p_n) \mapsto p_i$. So the sum
$$f = \sum_i f_i$$
must be concave. For a quick guide to doing this sort of analysis, watch Stephen Boyd's CVX 101 video 3 here.
A: Just like you computed the second-order derivative to verify the concavity of the univariate function, you will have to compute its equivalent for the multivariate case, i.e. the Hessian.
Suppose you have a function defined as $f(p_1,p_2) = p_1*(1-p_1) + p_2*(1-p_2)$.
Take the first-order partial derivatives:
$\partial f/\partial p_i = 1 - 2p_i$, for $i \in \lbrace 1,2 \rbrace$.
Take the second-order derivatives:
$\partial^2 f/\partial p_i^2 = - 2$ and $\partial^2 f/\partial p_i p_j = 0$ for $i,j \in \lbrace 1,2 \rbrace$.
The Hessian matrix as the general form: 
\begin{array}{cc}
  \partial^2 f/\partial p_1^2 & \partial^2 f/\partial p_1 p_2 \\
  \partial^2 f/\partial p_2 p_1 & \partial^2 f/\partial p_2^2
\end{array}
that is,
\begin{array}{cc}
  -2 & 0 \\
  0 & -2
\end{array}
Now, you are assured that $f$ is concave if this matrix is semi-definite negative. In this example, it is definite negative so the function is strictly concave. To verify this property of your matrix, there are many options. One of them, the most obvious here, is to look at the eigenvalues. If all eigenvalues are negative, then the Hessian is negative definite. In your case, the matrix is diagonal so the eigenvalues are the elements along the diagonal. Clearly it is negative definite so $f$ is strictly concave.
Good luck!
