$$\begin{array}{ll} \text{minimize} & \beta^{T} A \beta\\ \text{subject to} & \beta^{T} C \beta=1\\ & \beta \geqslant 0\end{array}$$


where $A, C\in \mathbb{R}^{M\times M}$ and $\beta \in \mathbb{R}^{M}$. I saw in one paper that it could be solved via its semidefinite programming relaxation by adding an auxiliary variable $B \in \mathbb{R}^{M \times M}$ like this:


$\min\_{\beta ,B}trace(AB)$


$s.t.trace(CB)=1$,


$\beta \geqslant 0$,


$\begin{bmatrix}
1 & \beta^{T}\\\\ 
 \beta& B
\end{bmatrix}\succeq 0$


where $\succeq 0$ means left matrix is positive semidefinite. I don't get how this is done, and besides, how to solve such a problem using any possible C/C++ software? Thanks.



A non-convex quadratically constrained quadratic program
It's helpful if you cite the paper in which you saw something that you're asking a question about- we could provide a better answer if we knew where the question came from. 


First, assume without loss of generality that $A$ and $C$ are symmetric matrices. It's easy to take these quadratic forms and write them in terms of symmetric matrices.


I believe that this problem transformation requires that $A$ be a positive semidefinite matrix- see below. 


We'll begin with your second problem and show that it is equivalent to the original problem. We begin with


$\min \mbox{tr}(AB) $


subject to


$\mbox{tr}(CB)=1$


$ \beta \geq 0 $


$\left[
\begin{array}{cc}
1 & \beta^{T} \\\
\beta & B 
\end{array}
\right]
\succeq 0
$


By Schur's theorem, the constraint


$\left[
\begin{array}{cc}
1 & \beta^{T} \\\
\beta & B 
\end{array}
\right]
\succeq 0
$


is equivalent to 


$B \succeq \beta \beta^{T} $


Note that we've implicitly restricted $B$ to being a symmetric matrix.


Next, write $B$ as 


$B= \beta \beta^{T} + LL^{T} $


where $L$ is the (slightly generalized) Cholesky factor of $B- \beta \beta^{T}$. If $B-\beta \beta^{T}$ is singular, then $L$ would be singular or even $0$. 


Then our problem is equivalent to 


$\min \mbox{tr}( A ( \beta \beta^{T} + LL^{T} ) ) $


subject to


$\mbox{tr}(CB)=1$


$ \beta \geq 0 $


$ B=\beta \beta^{T} + LL^{T} $


By the property $\mbox{tr}(DEF)=\mbox{tr}(FDE)$, this problem is equivalent to 


$\min \mbox{tr}(\beta^{T}A\beta + L^{T}AL) $


subject to


$\mbox{tr}(CB)=1$


$ \beta \geq 0 $


$ B=\beta \beta^{T} + LL^{T} $


Note that because $A \succeq 0$, $\mbox{tr}(L^{T}AL) \geq 0$ for all $L$, and the term is minimized when $L=0$.


Thus our problem is equivalent to:


$\min \mbox{tr}(\beta^{T}A\beta) $


subject to


$\mbox{tr}(CB)=1$


$ \beta \geq 0 $


$ B=\beta \beta^{T} $


Since $B=\beta \beta^{T}$, and by the cyclic property of $\mbox{tr}()$, this is equivalent to


$\min \mbox{tr}(\beta^{T}A\beta) $


subject to


$\beta^{T}C\beta=1$


$ \beta \geq 0 $


This was your original problem. 


