Finding a matrix to force a part of another matrix to be with null trace Assume I have a matrix $X$ whose size e.g., is $16$x$16$   and let's the matrix $x$ = $X_{(13:16,13:16)}$; it means it's the last square sub-matrix taken from the matrix $X$.  We know that $(x^H)^{-1}$$x^{-1} = z$ , where $(.)^H$ is the transpose of the matrix and $z$ is a scalar diagonal matrix having all its diagonal elements equal to e.g., $4$.
My question, I need to set a matrix $Y$ where $XY$ will make the trace of matrix $z$ null. it means for example a half of diagonal elements of matrix $z$ should be forced to be negative and the others positive. how can I select that matrix Y ?
 A: Here is how it can be solved in YALMIP (under MATLAB) as a nonlinear equation solve, which I am handling by specifying the nonlinear equations as constraints to a nonlinear optimization problem not having any objective function (to be minimized or maximized).
Let X21 denote the lower left 12 by 4 block of X.
Let X22 denote the lower right 4 by 4 block of X.
I will create "optimization" variables:
Y12, which is a 12 by 4 matrix variable consisting of the upper right 12 by 4 block of the matrix Y which you seek.
Y22, which is a 4 by 4 matrix variable consisting of the lower right 4 by 4 block of the matrix Y which you seek.
Let xy denote the lower right 4 by 4 block of $XY$, i.e., the analog of x as applied to $XY$. By use of block matrix multiplication, it can be seen that $xy$ depends only on the matrix blocks mentioned above. So, for instance, the upper left 12 by 12 blocks of X and Y are totally irrelevant to the problem at hand, as are the lower left 4 by 12 block of Y and upper 12 by 16 block of X.
Because $xy^{-1}$ can't be directly handled by YALMIP, I will create a variable xy_inverse. In order to make it meaningful as such, impose the constraint that xy*xy_inverse equals the Identity matrix.
Then the "z" corresponding to $xy$, is constrained to have trace equal to zero.
The solver is then called to try to find a solution. It may be that there is no solution, i.e., the problem is infeasible. In general, the problem need not be feasible.
In order to be sure the problem is infeasible, that determination must be made by a rigorous global optimization solver (not genetic algorithm and similar heuristic algorithms which are called global optimization). The solver I specified, bmibnb, is a rigorous global optimization solver included with YALMIP.
Y12 = sdpvar(12,4,'full');
Y22 = sdpvar(4,4,'full');
xy = X21*Y12+X22*Y22;
xy_inverse = sdpvar(4,4,'full');
Constraints = [xy*xy_inverse == eye(4),trace(xy_inverse'*xy_inverse) == 0];
optimize(Constraints,[],sdpsettings('solver','bmibnb'))

If a feasible solution has been found, value(Y12) and value(Y22) contain values of Y12 and Y22 which meet the requirements.  The other blocks of Y can be anything you want and don't affect whether the requirements are met.
