# How do I solve a problem with objective containing a norm-squared term plus other norm terms? [SOLVED]

I want to solve the problem argmin(1/2*(norm(x-y, 'fro))^2 + lambda1*(norm(x, 1)) + lambda2*norm_nuc(x) ), where lambda1 and lambda2 are fixed constants. The objective function is convex since it’s the sum of norms and a norm-squared term. But the norm-squared term is not being accepted. How can I reformulate this problem under the DCP ruleset?

Here is the code:

`Y = randn(10, 10); n = 10; cvx_begin variable X(n, n) minimize(1/2*(norm( Y - X , 'fro'))^2 + 0.3*norm(X, 1) + 0.85*norm_nuc(X)) cvx_end`

And as expected, it gives me the following error:

``````??? Error using ==> cvx.pow_cvx at 142
Disciplined convex programming error:
Illegal operation: {convex} .^ {2}
(Consider POW_P, POW_POS, or POW_ABS instead.)

Error in ==> cvx.power at 55
z = pow_cvx( x, y, 'power' );

Error in ==> cvx.mpower at 9
z = power( x, y );
``````

I don’t think I can get rid of the squared norm term since the smoothing operator is needed.

Thank you!

Change
`(norm( Y - X , 'fro'))^2`
to
`square_pos(norm( Y - X , 'fro'))`

Or you could use pow_p, pow_pos,or pow_abs, as hinted at in the error message.

CVX 3.0 expands the DCP ruleset slightly to handle cases like this, but Mark is right. Also, I would consider using `sum_square(vec(Y-X))`.

Thanks a lot Mark and Michael. That worked!