SymmetricPolynomial[2, {Subscript[x, 1], Subscript[x, 2], Subscript[x,   3], Subscript[x, 4]}]

$$\begin{align*}x_1 x_2+x_3 x_2+x_4 x_2+x_1 x_3+x_1 x_4+x_3 x_4\tag{1}\end{align*}$$

Plus @@ Subsets[  Times[Subscript[x, 1], Subscript[x, 2], Subscript[x, 3], Subscript[   x, 4]], {2}]

$$\begin{align*}x_1 x_2+x_3 x_2+x_4 x_2+x_1 x_3+x_1 x_4+x_3 x_4\tag{2}\end{align*}$$

However if I follow the formula (3) from this page.

Then, I'll not get (1), but get (4)

$$\begin{align*}\sum _{m=1}^{n-1} \prod _{k=m+1}^n x_k x_m\tag{3}\end{align*}$$

\!\(\*UnderoverscriptBox[\(\[Sum]\), \(m = 1\), \(n - 1\)]\(\*UnderoverscriptBox[\(\[Product]\), \(k = m + 1\), \(n\)]\*SubscriptBox[\(x\), \(k\)]\ \*SubscriptBox[\(x\), \(m\)]\)\) /. n -> 4

$$\begin{align*}x_2 x_3 x_4 x_1^3+x_2^2 x_3 x_4+x_3 x_4\tag{4}\end{align*}$$

Since $\prod _{k=m+1}^n x_kx_m$ may be some notations that I'm not familiar with, I'm not sure whether the formulas in the wiki's page is wrong.

Replace product in (3) with summation, then we will get the right/expected result.

\!\(\*UnderoverscriptBox[\(\[Sum]\), \(m = 1\), \(n - 1\)]\(\*UnderoverscriptBox[\(\[Sum]\), \(k = m + 1\), \(n\)]\*SubscriptBox[\(x\), \(k\)]\ \*SubscriptBox[\(x\), \(m\)]\)\) /. n -> 4

$$\begin{align*}x_1 x_2+x_3 x_2+x_4 x_2+x_1 x_3+x_1 x_4+x_3 x_4\tag{5}\end{align*}$$

Mathematica graphics

Mathematica graphics

Are the formulas wrong? or Is my calculating method in Mathematica wrong?

Note that some notations with the complex use of $\Pi$ and $\sum$ in symmetric polynomials

  • $\begingroup$ A notebook on this can be downloaded from MathWorld - may require additional packages, see instructions in the source file. $\endgroup$
    – Jens
    Aug 10, 2013 at 6:15
  • $\begingroup$ @Jens Ok, I've tried that, seems not the same like the result of $x1x2+x1x3...$? Let me look at some more time. $\endgroup$ Aug 10, 2013 at 6:22
  • $\begingroup$ Reading the MathWorld article Jens linked to it seems to me you're quite confused as to what Vieta's formulas do. For instance, in the products, roots are never repeated. Every component i consists of the sum of all possible products of i roots out of n. Your sum-product doesn't do that at all. You need something like Apply[Plus,Product@@@Subsets[{x1,x2,...,xn},{i}]]. I'm going to vote to close this, as you apparently have not really sorted out what you want. What you call expansion seems a far cry from that. $\endgroup$ Aug 10, 2013 at 7:51
  • $\begingroup$ @SjoerdC.deVries Sorry, I'm not sure whether this is an error formula. Seems write sigma in place of product will gives the right answer? ![here is the page where the formula comes from] (zh.wikipedia.org/wiki/%E9%9F%A6%E8%BE%BE%E5%AE%9A%E7%90%86) $\endgroup$ Aug 10, 2013 at 11:18

1 Answer 1


[This answer was made while the OP question kept being changed...I hope it is current.]

The easy way is to use the built-in SymmetricPolynomial:

vietePoly[deg_Integer, n_Integer, var_: \[FormalX]] := 
 SymmetricPolynomial[deg, Array[var, n]]

vietePoly[2, 4, x]
(* x[1] x[2] + x[1] x[3] + x[2] x[3] + x[1] x[4] + x[2] x[4] + x[3] x[4] *)

The formula for degree 2 should have a sum instead of product:

$$\sum _{m=1}^{n-1} \sum _{k=m+1}^n x_k x_m $$

The general formula for the symmetric polynomial of degree $k$ is

$$s_k = \sum_{1 \le i_1 < i_2 < \cdots < i_k \le n} x_{i_1} x_{i_2} \cdots x_{i_k}$$

Sum[x[m] x[k], {m, 1, n - 1}, {k, m + 1, n}] /. n -> 4 // Expand
(* x[1] x[2] + x[1] x[3] + x[2] x[3] + x[1] x[4] + x[2] x[4] + x[3] x[4] *)
  • $\begingroup$ Ha, I just edited my post, I doubt the formulas in the wiki's page is wrong? So, you are the same opinion,right? $\endgroup$ Aug 10, 2013 at 12:27
  • $\begingroup$ @HyperGroups Yes, I think there's a simple type, a product $\Pi$ in place of a summation $\Sigma$. If you look at my formula for $s_k$, then summation term is sometimes written with a $\Pi$ $\endgroup$
    – Michael E2
    Aug 10, 2013 at 12:30
  • $\begingroup$ I wasn't aware of SymmetricPolynomial. Good one. It seems to be equivalent to the code that I provided in the comment below the question. $\endgroup$ Aug 10, 2013 at 13:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.