# Disciplined Convex Programming

Dear Friends,

I have tried to solve a problem in CVX which includes the following constraint:

`````` trace(w1*w1' + w2*w2') <= P_R;
``````

in which w1 and w2 are \$(N,1)\$ vectors. But I get the following error when I try to run it:

`````` Disciplined convex programming error:
Invalid quadratic form: must be a scalar.
``````

This constraint used to work when I used w1w1'=X1 and w2*w2'=X2 in which X1 and X2 are N by N hermitian matrices. Thank you for devoting your time.

Note that \mathop{\textrm{Tr}}(AB)=\mathop{\textrm{Tr}}(BA) whenever the multiplication commutes. Therefore,\$\$\mathop{\textrm{Tr}}(w_1w_1^H+w_2w_2^H) =
\mathop{\textrm{Tr}}(w_1w_1^H)+\mathop{\textrm{Tr}}(w_2w_2^H)=
\mathop{\textrm{Tr}}(w_1^Hw_1)+\mathop{\textrm{Tr}}(w_2^Hw_2)=|w_1|_2^2+|w_2|_2^2.\$\$
So this constraint is equivalent to

``````sum_square_abs(w_1)+sum_square_abs(w_2) <= P_R.
``````

If `P_R` is a constant, then itâ€™s a bit better to use norms instead:

``norm([w_1;w_2]) <= sqrt(P_R).``

Dear Michael,

Very nice, thank you a lot for supporting us.