Sums-of-squares for dummies: a view from the Fourier domain
In these last two years, I have been studying intensively sum-of-squares relaxations for optimization, learning a lot from many great research papers [1, 2], review papers [3], books [4, 5, 6, 7, 8], and even websites.
Much of the literature focuses on polynomials as the de facto starting point. While this leads to deep connections between many fields within mathematics, and many applications in various areas (optimal control, data science, etc.), the need for arguably non-natural hierarchies (at least for beginners) sometimes makes the exposition hard to follow at first, and notations a tiny bit cumbersome.
I think that one reason is the aim for generality of the approaches. If you want to minimize potentially arbitrary continuous functions on a set defined by arbitrary equality or inequality constraints, there is not much choice if you want a unique generic mathematical framework that can approximate all of these problems. But if you are willing to optimize an arbitrary continuous function only on a “simple” set, then things considerably simplify: most results have explicit reasonably simple proofs, and you can even prove the exponential convergence of the SOS hierarchy! The main goal of this post is to present such old and recent results.
One other aim is to highlight the classical dual view of optimization problems through the characterization of probability measures by their moments, which has many applications beyond optimization.
By simple sets, I mean the interval as a toy example, but by taking tensor products, this extends to the hypercube , and with a bit more work, you can add the Boolean hypercube and Euclidean spheres (see below). The key property that we will need is the availability of a nice orthonormal basis of square integrable functions.
Minimization of quadratic forms
In order to cover all cases, I will consider a generic minimization problem,
For our running example, with , we can consider the Fourier basis
We see immediately in this example, that the representation of through is not unique. This is due to the fact that in the real vector space of Hermitian matrices of dimension , the rank-one matrices may only occupy a specific linear subspace, which we denote . For the specific case of univariate trigonometric polynomials, we have
We will often use the trace trick to represent a quadratic form as a linear form in , that is,
Two dual convex views
The minimization of has two dual convex optimization formulations, which are both natural, and which both provide insights into the problems.
Maximizing lower bounds. The first view is simply maximizing a lower bound on , that is,

As mentioned in an earlier post, all optimization problems are thus convex! The hard computational task here is to represent efficiently non-negative functions to handle the (convex) constraint that is non-negative.
Mininimizing expectations. The second view is looking for a probability measure on with minimal expectation . Denoting the set of probability distributions on , we have:
When can be represented by a quadratic form, then the objective function becomes , which is linear in the moment matrix

Convex hull and span of all , , when has 5 elements.
A key computational task will be to find outer approximations of based in particular on the knowledge of .
Equivalence by convex duality. The two views are equivalent as one can see as the Lagrange multiplier for the constraint , which has to be a finite positive measure [10]. The Lagrangian is
Convex relaxation: the sum-of-squares (SOS) view
A natural idea to characterize non-negative functions represented as quadratic forms is to consider positive-semidefinite (PSD) Hermitian matrices, that is, Hermitian matrices with non-negative eigenvalues. Indeed, if with (which is another notation for PSD), then for all . This leads to the relaxation:
We can write the equality constraint compactly as (using that features have unit norm):
The relaxation is tight for all , if and only if all non-negative functions represented as quadratic forms are SOS. This is not the case in general, and the relaxation is thus not tight in general, except in a few cases like uni-dimensional trigonometric polynomials.
It is tempting to set , and consider , which is directly a lower-bound on the minimal value of , because, since features have been assumed to have unit norm,
Before looking at the performance of such relaxations, let’s first look at the dual view.
Convex relaxation: the moment view
Given that the objective function is linear in , a traditional approach is to find outer approximations of the convex set . The least we can expect from an outer approximation is that the affine hull is preserved, that is, we want to make sure that a matrix in our approximation satisfies (that is, Toeplitz for the trigonometric polynomial case), and (coming from ).
Another natural property of the matrices is that they are positive semi-definite (PSD). The moment relaxation will exactly be the combination of these two properties (affine hull + PSD), leading to the outer approximation
Removing the constraint that , we obtain again the (weaker) spectral relaxation.
Note that the outer approximation of by has many applications beyond optimization (see, e.g., [4, 7]). We get a tight relaxation for all , if and only if , which happens only in a few cases.
Equivalence by convex duality
By introducing the same Lagrange multiplier which is now a signed measure (since we have an equality constraint), we obtain the Lagrangian
The two views are thus equivalent, and tightness of one is equivalent to the tightness of the other. We will see below that for our running example of univariate trigonometric polynomials, the relaxation is tight, before looking at the multivariate case, where the relaxation is not tight, but can be made as tight as desired. We will then allow infinite-dimensional feature maps by allowing infinitely many frequencies.
Let’s first mention a few “practicalities”: solving either or with efficient algorithms, and obtaining a candidate minimizer from a moment matrix .
Convex optimization algorithms. Standard interior point methods for semi-definite programming problems can be used for either or . This will become slow when the dimension of the feature map gets large, as each iteration will be of complexity . Moreover, encoding the vector space can be rather painful when has many dimensions. For efficient descriptions of based on sampling, see the kernel section below. For efficient algorithms based on smoothing the minimal eigenvalue, see the bottom of the post.
Recovering a minimizer. This is often referred to as “extraction” in the SOS literature [29], and a variety of techniques exist. Note also that randomized techniques which are classical in combinatorial optimization can also be considered [30].
Univariate trigonometric polynomials
We first start with the SOS view, by showing that all non-negative trigonometric polynomials are sums-of-squares, and here a single square.
Fejér-Riesz theorem [11, 12] (if you can read German). We consider a trigonometric polynomial of degree , that is, with real non-negative values. This imposes that . Then it is non-negative if and only if it can be written as the square modulus of a complex-valued trigonometric polynomial. The elementary proof based on roots of polynomials is shown at the end of the post.
We here get a single square, with an elementary proof. Note that this is a stronger result than being a sum of several squares. We can now look at the dual intepretation.
Positivity of Hermitian Toeplitz matrices. As mentioned earlier, our approximation set for is the set of PSD Toeplitz matrices of unit trace. We have a tight relaxation if we can show that for any such matrix , there exists a probability measure on such that
Comparison with spectral relaxation. Assume we are given a trigonometric polynomial of degree , that is, . As mentioned earlier, there are many ways of representing it as a quadratic form with for . This will not change the SOS relaxation but will make a difference for the spectral relaxation. One standard one is to choose to be a Toeplitz matrix. Since should depend only on , by counting the number of elements in each diagonal, we must have
The spectral relaxation amounts to compute the lowest eigenvalue of a Toeplitz matrix, which is a well studied problem [9], in particular when the dimension of the matrix grows. In our context, this corresponds to considering a feature of size larger than (like we will do for multivariate polynomials below), representing the function in this basis through a Toeplitz matrix of size with the same formula as , and seeing how the spectral relaxation tends to the optimal value when goes to infinity.
We first consider the Toeplitz matrices with values for , which is, a band-diagonal Toeplitz matrix. it is shown in [31, Section 5.4] that the lowest eigenvalue of this Toeplitz matrix has the following asymptotic expansion where is the minimizer of (assumed to be unique). We thus get an upper approximation of . By taking into account the multiplicative factor from Eq. , we get an overall factor of , which is what we observe in practice (see simple experiment below).
The spectral relaxation is convergent, but much slower than the SOS relaxation (which is tight for ).

Left: trigonometric polynomial of degree 4. Right: performance of the spectral relaxation, which requires a large degree to be a close approximation (with observed rate ). Here the SOS relaxation for is already tight.
Consequences for regular polynomials on . Non-negative polynomials on can also be characterized, by looking at the non-negativity of for , which is equivalent to the existence of a complex trigonometric polynomial whose square modulus is exactly . Playing around with Chebyshev polynomials of the two kinds, one can show that then has to a sum of terms of the form , where and are polynomials, which is the classical SOS characterization of non-negative polynomials in [15]. See all details and the extension to higher dimensions in [33].
Extension to multivariate trigonometric polynomials
We now consider multivariate trigonometric polynomials in dimension , on , which are polynomials in . We first start with a counter-example to the equivalence between non-negativity and being a sum of squares.
Negative result (counter-example). Non-negative polynomials may not be sums-of-squares, as shown by this counter example based on Motzkin’s example [22]:
So not all non-negative polynomials are sums-of-squares in dimension larger than 1. This is however not the end of the story, as we now describe.
Towards positive results. We consider a trigonometric polynomial, that is, a function where is a function of the form
We now state a few results relating non-negativity and sums-of-squares, whose “elementary” proofs will either be sketched at the end of this post (below references) or available in [33].
Strictly positive polynomials are sums-of-squares. For any multivariate trigonometric polynomial of the form above, if is strictly positive on , then there exists a finite family of trigonometric polynomials such that
There are two key deviations from the univariate case:
- The degrees of the squares can be larger than the degree of and are not bounded a priori, thus, we need to try sums of squares of degrees larger than the degree of , thus creating a hierarchy of optimization problems of higher dimensions, whose optimal value will converge to the minimum of .
- Only strictly positive polynomials can always be decomposed, implying we may not have finite convergence of the hierarchy in general.
It implies that SOS hierarchies will always converge to the true value, without giving any idea of the convergence rate. The next result provides such a result (but still quite pessimistic), without any assumption.
Adding an arbitrarily small constant to a non-negative trigonometric polynomial makes it an SOS of known degree. Given a multivariate trigonometric polynomial of degree less than with values in , is a sum of squares of polynomials of degree less than as soon as for some . Moreover, when , we have recently shown in [33] that, asymptotically, . This immediately provides the convergence rate for the SOS relaxation of degree .
This results in an adaptation of [20] to rather than the hypersphere, which makes the proof significantly faster (see [33] and the related results for regular polynomials on in [34]). It provides a quantitative guarantee (even more explicit than for regular polynomials [26]): the approximation guarantee scales as , with a feature dimension , and thus with a feature of dimension , we get an error proportional to , thus with a scaling in the underlying dimension subject to the curse of dimensionality.
Comparison with spectral relaxation. Using the same reasoning as in dimension , we get instead a convergence rate in for the spectral algorithm. So we get convergence, at rate which is only slightly worse. However, the behavior in is empirically observed in practice in all cases, while the rate in for the SOS relaxation is pessimistic, and the convergence rate is much better in practice. Can we obtain tighter convergence rates?
Exponential convergence
In order to show exponential convergence when the degree goes to infinity, we need to add an extra assumption regarding the behavior of the function around its minimizer. Essentially, all global minimizers are isolated and the Hessian is invertible. This is often referred to as “strict-second-order minimizers”, and such assumptions have already been used to show finite convergence of the hierarchy, although with no bound on the required degree [35].
Leveraging our earlier work [21, 24], we recently showed in [33] with Alessandro Rudi that the convergence rate was exponential when the minimum is attained at isolated points with invertible Hessians. The proof is a bit involved, but rely on a crucial point. We deviate from previous work on polynomial hierarchies by a strong focus on smoothness properties of the optimization problems rather than its algebraic properties. More precisely, this allows us to use square roots and matrix square roots together with their differentiability properties (square roots typically lead to non-polynomial functions when taken on polynomials).
Optimization beyond trigonometric polynomials
When is not a trigonometric polynomial, there are essentially two options: (1) approximate with a trigonometric polynomial and minimize the approximation with the SOS hierarchy, or (2) target directly the minimization of the original function through sampling. The second option is described in the next section (and was already the topic of an earlier blog post). We now describe the first option.
Approximation by truncated Fourier series. Depending on how the function is accessed, through function values or through values of its Fourier series, the approximation of a regular function through a degree polynomial is a well-studied problem. For simplicity, I only consider truncating the Fourier series obtained by keeping frequencies such that . The error which is made depends on the regularity of the original function, that is, if has all of its -th order derivatives that are bounded, then the truncation error is of order . Thus, to reach precision , we need basis functions. See an illustration below in two dimensions, where aim to approximate the function below.

The function is approximated by computing the Fourier series and keeping only frequencies such that for varying .

Extension to function value oracle
Now that the traditional “décor” of sum-of-squares optimization based on finite-dimensional expansions has been set, we can look at recent infinite-dimensional extensions based on positive definite kernels.
From knowing to exact sampling. In the formulation above, instead of using an explicit representation of as , and determine precisely , an alternative is to use sufficiently many distinct points , and use the constraint:
Undersampling and regularization. A key insight from [21] is to consider situations where the number of samples is not large enough, and add a regularizer , that is,
When is large enough and is sufficiently small, this leads to a controlled approximation. This is particularly interesting when is infinite-dimensional and such that the relaxation is tight, which we now look at.
Infinite-dimensional feature map. In the trigonometric polynomial example, we can consider
Tightness. A key benefit of going infinite-dimensional is that the SOS relaxation is always tight as soon as for all . Indeed, the relaxation is the following optimization problem:
We can now combine with “sampling + regularization” technique mentioned above, and only query the function at a finite number of points. As shown in [21, 24], with a proper choice of , then we get a convergence rate of when is -times differentiable. When is infinitely-differentiable (like for functions with finite support), we can get exponential convergence in , but with a constant in from of the exponential that can be exponential in dimension. See more details in an earlier blog post and in [33].
Representer theorem. Another consequence is a “representer theorem”, that is, we can reduce the search to with positive-semidefinite. Like for traditional kernel methods, the representer theorem is particularly interesting when is infinite like above.
But this is already useful with finite-dimensional embeddings where the span is difficult to characterize. In this case, only the kernel has to be simple to compute; for example, for the usual finite support case, we have
Extension to Boolean hypercube
When , we can use feature vectors composed of Boolean Fourier components of increasing orders [16]. This corresponds to features of the form , where is a subset of . They are all normalized.
If we consider a set of subsets of , then, the element indexed of only depends on the symmetric difference . The relaxation is not tight in general, but if we see our moment matrix as a submatrix obtained from a sufficiently larger set of subsets, then we obtain a tight formulation (here we know that the hierarchy has to be finite [17, 18, 19]).
At the first layer (with composed of singletons), we get the traditional semi-definite programming relaxation of quadratic optimization problems on [30]. See this nice website for the many extensions. An interesting aspect is that tightness is not necessary in many applications.
Extension to hyperspheres
It is common to see the set with periodic functions as the one-dimensional torus, that is, the quotient set . Another classical interpretation is to see it as the unit circle in , with the bijection . The real Fourier basis functions and are then polynomials in and . Not all polynomials are recovered, as one can check that we need to have , that is the Laplacian of is zero, which is often referred to as being harmonic. This extends to hyperspheres in any dimension (see [20] for details), and also to Euclidean balls by adding a dimension.
Conclusion
In this blog post, I have tried to describe the basics of sums-of-squares optimization, hopefully from a simple perspective. The key was to reduce the scope to the minimization over simple sets with no complex constraints. This allowed us to present significantly improved convergence results from [33].
There is of course many more interesting ideas to cover, such as constrained optimisation, applications within signal processing [8], and extensions to the computation of log-partition functions [32], as well as important practical scalability issues to alleviate. Moreover, the SOS framework goes beyond optimization, either through other infinite-dimensional optimization problems or moment-based formulations (see many examples in [4, 7]). Many topics for future posts!
Acknowledgements. I would like to thank Alessandro Rudi for proofreading this blog post and making good clarifying suggestions.
References
[1] Jean-Bernard Lasserre. Global optimization with polynomials and the problem of moments. SIAM Journal on Optimization, 11(3):796–817, 2001. [2] Pablo A. Parrilo. Semidefinite programming relaxations for semialgebraic problems. Mathematical Programming, 96(2):293–320, 2003. [3] Monique Laurent. Sums of squares, moment matrices and optimization over polynomials. In Emerging applications of algebraic geometry. Springer, 157-270, 2009. [4] Jean-Bernard Lasserre. Moments, positive polynomials and their applications. World Scientific, 2009. [5] Grigoriy Blekherman, Pablo A. Parrilo, Rekha R. Thomas, editors. Semidefinite optimization and convex algebraic geometry. Society for Industrial and Applied Mathematics, 2012. [6] Jean-Bernard Lasserre. An introduction to polynomial and semi-algebraic optimization. Cambridge University Press, 2015. [7] Didier Henrion, Milan Korda, and Jean-Bernard Lasserre. The Moment-SOS Hierarchy: Lectures In Probability, Statistics, Computational Geometry, Control And Nonlinear PDEs. World Scientific, 2020. [8] Bogdan Dumitrescu. Positive trigonometric polynomials and signal processing applications. Springer, 2007. [9] Robert M. Gray. Toeplitz and circulant matrices: A review. Foundations and Trends in Communications and Information Theory 2(3): 155-239, 2006. [10] Johannes Jahn. Introduction to the Theory of Nonlinear Optimization. Springer, 2020 [11] Leopold Fejér. Über trigonometrische Polynome. Journal für die reine und angewandte Mathematik. 146:55-82, 1916. [12] Friedrich Riesz. Über ein Problem des Herrn Carathéodory. Journal für die reine und angewandte Mathematik. 146:83-87, 1916. [13] C. Carathéodory and L. Fejér. Über den Zusammenhang der Extreme von harmonischen Funktionen mit ihren Koeffizienten und über den Picard-Landauschen Satz, Rendiconti del Circolo Matematico di Palermo, 32:218–239, 1911. [14] Mihály Bakonyi, Ekaterina V. Lopushanskaya. Moment problems for real measures on the unit circle. Recent Advances in Operator Theory in Hilbert and Krein Spaces. Birkhäuser Basel, 49-60, 2009. [15] Victoria Powers and Bruce Reznick. Polynomials that are positive on an interval. Transactions of the American Mathematical Society, 352(10):4677–4692, 2000. [16] Ryan O’Donnell. Analysis of Boolean functions. Cambridge University Press, 2014. [17] Jean-Bernard Lasserre. An explicit exact SDP relaxation for nonlinear 0–1 programs. In International Conference on Integer Programming and Combinatorial Optimization, pages 293–303. Springer, 2001. [18] Monique Laurent. A comparison of the Sherali-Adams, Lovász-Schrijver, and Lasserre relaxations for 0–1 programming. Mathematics of Operations Research, 28(3):470–496, 2003. [19] Lucas Slot and Monique Laurent. Sum-of-squares hierarchies for binary polynomial optimization. Mathematical Programming, pages 1–40, 2022. [20] Kun Fang and Hamza Fawzi. The sum-of-squares hierarchy on the sphere and applications in quantum information theory. Mathematical Programming, 190(1):331–360, 2021. [21] Alessandro Rudi, Ulysse Marteau-Ferey, Francis Bach. Finding Global Minima via Kernel Approximations. Technical report arXiv:2012.11978, 2020. [22] Aron Naftalevich, and M. Schreiber. Trigonometric polynomials and sums of squares. In Number Theory. Springer, 225-238, 1985. [23] Alexandre Megretski. Positivity of trigonometric polynomials. In International Conference on Decision and Control, 2003. [24] Blake Woodworth, Francis Bach, Alessandro Rudi. Non-Convex Optimization with Certificates and Fast Rates Through Kernel Sums of Squares. In Proceedings of the Conference on Learning Theory, 2022. [25] Diego Cifuentes, Pablo A. Parrilo. Sampling algebraic varieties for sum of squares programs. SIAM Journal on Optimization, 27(4): 2381-2404, 2017. [26] Jean-Bernard Lasserre. A sum of squares approximation of nonnegative polynomials. SIAM Review, 49(4):651-669, 2007. [27] Yurii Nesterov. Smoothing technique and its applications in semidefinite optimization. Mathematical Programming 110(2):245-259, 2007. [28] Mihai Putinar. Sur la complexification du problème des moments. Comptes Rendus de l’Académie des Sciences, Série 1, Mathématique 314(10):743-745, 1992. [29] Didier Henrion and Jean-Bernard Lasserre. Detecting global optimality and extracting solutions in GloptiPoly. In Positive polynomials in control, pages 293-310, 2005. [30] Michel X. Goemans and David P. Williamson. Improved approximation algorithms for maximum cut and satisfiability problems using semidefinite programming. Journal of the ACM, 42(6):1115–1145, 1995. [31] Ulf Grenander, and Gabor Szegö. Toeplitz forms and their applications. Univ of California Press, 1958. [32] Francis Bach. Sum-of-Squares Relaxations for Information Theory and Variational Inference. Technical report, arXiv:2206.13285, 2022. [33] Francis Bach and Alessandro Rudi. Exponential convergence of sum-of-squares hierarchies for trigonometric polynomials. Technical report arXiv:2211.04889, 2022. [34] Monique Laurent and Lucas Slot. An effective version of Schmüdgen’s Positivstellensatz for the hypercube. Optimization Letters, 2022. [35] Jiawang Nie. Optimality conditions and finite convergence of Lasserre’s hierarchy. Mathematical Programming, 146(1):97–121, 2014
Proof of Fejér-Riesz theorem
We consider a trigonometric polynomial of degree , that is, with real non-negative values. This imposes that . We assume that . We consider the rational function , so that . We can write as for a polynomial of degree . We can now examine the roots of . The identity implies that if is a root of , so is . Thus all roots which do not have unit modulus come in pairs , for , with . We then have roots of unit modulus, denoted , for .
Thus, we can write the polynomial as:
We here get a single square, with an elementary proof. Note that this is a stronger result than being a sum of several squares. We can now look at the dual intepretation.
First-order algorithms
In order to solve the problem in Eq. , we can use standard smoothing [27], that is, replace by , and apply accelerated projected gradient descent, which requires to orthogonally project on , or equivalently on .
All strictly positive trigonometric polynomials are sums-of-squares
In order to provide an “elementary” proof of this result that dates back to [28], we follow [23] and proceed by contradiction, and assume that there is a strictly positive trigonometric polynomial which is not a sum-of-squares. Since the set of SOS polynomials is a convex cone, by the Hahn-Banach theorem, there must exist a non identically zero linear form which is non-negative on all SOS polynomials, and such that . In order to conclude, we will need to show that linear forms on trigonometric polynomials that are non-negative on SOS polynomials, can be written as
We now need to show that all bounded linear forms on trigonometric polynomials that are non-negative on SOS polynomials can be represented as in Eq. .
Using Bochner’s theorem. We define a function as . This function is positive definite, as, for any and any complex numbers ,