# Optimization of square matrix multiplied with another matrix to have the final result a unitary matrix

I have a square matrix $$D$$ whose size is $$m \times m$$ multiplied with another $$m \times m$$ square matrix $$C$$, I need to optimize the matrix $$C$$ to have a unitary matrix $$DC$$. I mean optimize the matrix $$C$$ such as $$DC$$ is a unitary matrix.

In my opinion, that can be formulated as below:

\begin{align} \min_C \|DC - Y\|^2_F&& \text{s.t.}&&(DC)(DC)^H = I_m \end{align}

where $$\|\cdot\|_F$$ is the Frobenius norm operator and $$Y$$ is any unitary matrix.

So, I don't know if we can deal with the above equality as a variant of the Procrustes problem or that's not possible. Is it possible to optimize that above equation based on $$C$$ following my way ? or is there another way we can set the matrix $$C$$ to have $$(DC)(DC)^H = I_m$$ ?

NB: All the matrices are real and $$det(D) = 0$$.

• If $det(D) \ne 0$ D is invertible and you can just use $C = D^{-1}$. Than you have $D \cdot C = I$ and $I$ sure is unitary. Jun 5, 2021 at 15:20
• @Hilmar What's about if $det(D) = 0$ ? Jun 5, 2021 at 15:26
• Then your problem isn't solvable: If $det(D) = 0$ then $det(D\cdot C) = 0$. That means the product can't be unitary regardless of C. I'll turn this into an answer, since I think that's all there is to it Jun 5, 2021 at 16:33
• Hey Fatima, I think Hilmar's answer is factually correctly answering your question as stated, but I'm not sure it's what you meant. Is it possible $\text{mean}_C$ is supposed to mean $\min\limits_C$? Jun 5, 2021 at 19:11
• and when you say "$Y$ is any unitary matrix", does it mean you can freely choose $Y$ as long as it's unitary, or is $Y$ externally given? Jun 5, 2021 at 19:19

Could it be that you are indeed looking for the closest orthogonal matrix $$Y$$? Then, there is a solution which involves computing the square root of $$D^TD$$ . If $$E=(D^TD)^{1/2}$$ were invertible, the solution would be its inverse. Yet, it is not invertible here. Then, there is a trick. If I remember well, you have to perform an eigenvalue/eigenvector decomposition of $$E$$, replace the null eigenvalues by $$1$$, you then get a novel matrix $$E^*$$ which is invertible, and its inverse is the (unique) solution.

If what I wrote is correct enough, I might come back with details. Meanwhile, you can look at:

• Yes Exactly, I am looking for the closest unitary matrix $Y$. The matrix $E$ in my case is not invertible. Could you please explain how to solve that matrix $E$? ... Thanks again Jun 6, 2021 at 4:35
• Yes, please let me some time. Did you check the two links, did you understand the basic steps? Jun 6, 2021 at 5:46
• I am reading it, but I couldn't get its exact idea. I try to implement when I understand from it in Matlab but something wrong is happening. Please, your explanation will be really appreciated. Jun 6, 2021 at 8:05
• Second, based on my understanding, $E$ might be complex matrix. However all other matrices are real. I don't know if it can be set to real or no. Anyway, awaiting for you explanation, thanks again. Jun 6, 2021 at 12:02
• Sure, as long as it is clear that we do this on our free time Jun 10, 2021 at 22:04

If D is not singular, i.e. $$\operatorname*{det}(D) \ne 0$$ than simply $$C = D^{-1}$$ will do the trick, since $$D \cdot C = I$$, which is obviously unitary.

If D is singular, i.e. $$\operatorname*{det}(D) = 0$$ than the product is also singular, i.e. $$\operatorname*{det}(D \cdot C)=0$$ which means the product cannot be unitary for all possible matrices $$C$$.