# Invalid constraint: {convex} == {real constant} error

Hello everyone,

I am trying to solve the following optimisation problem
\begin{array}{l}
\min \left| x \right| _2 \
\text{subject to} \left| A x \right|_2 = \left| A \right|_2
\end{array}

where x \in \mathbb{R}^N, N \in \mathbb{N} , and A \in \mathbb{R}^{N \times N}.

I code it in cvx as

cvx_begin
variable x(length(A));
minimize (norm(x,2));
subject to
norm (A*x,2)==norm (A,2);
cvx_end

and I get the following error

error using ==> cvxprob.newcnstr at 192
Disciplined convex programming error:
Invalid constraint: {convex} == {real constant}

Is there anyway to overcome this error so I can solve the problem with cvx? can it be rewritten in another way so cvx can deal with it?

Sorry if it is a quite naive question, I am just learning about convex optimisation and cvx.

Clemente

The constraint is non-convex. Read Why isn’t CVX accepting my model? READ THIS FIRST!
. You can also work through http://stanford.edu/~boyd/cvxbook/ .

Thanks for the answer. I guess you meant that the constraint is non affine.

It is non-affine and non-convex.

I believe the constraint is convex since \|A(tx+(1-t)y)\|\leq t\|Ax\|+(1-t)\|Ay\| for all t\in[0,1] in virtue of the triangular inequality

No, it is not a convex constraint. The LHS of the constraint is convex, as you have shown. And if the constraint were LHS <= a real constant, it would be convex. However, the constraint is LHS == a real constant, and that is not a convex constraint, unless that constant, norm(A), happens to equal 0