# How to select the location of submatrices to have specific property in the output of multiplication

I want to set the locations of two submatrices W22 and W21 taken from Hadamard matrix, with respect to W22 keeps being unitary and matrix T has non-zeros values in the first columns only (Regardless the number of columns that are non-zeros), T is sparse matrix. How to do that in Matlab?

For example this is the matlab code:

N = 16;       %size of the matrix
P = N/4;      % size of the submatrix must be unitary
W = hadamard(N);  %Hadamard matrix

W21 = W(end- P +1:end, 1:end- P);     %Initial submatrix
W22 = W(end- P +1:end,end- P +1:end);  %the other submatrix
T = inv(W22)*W21;


I really don’t know how to start that process, I tried the following way:

s = rand(size(T,2),1);    % set a random vector with first values to be zeros to be optimized
s(1: P) = 0;
T2 = sum(abs(T*s));


So, I need to keep the submatrix W22 unitary and optimize the T2, but I couldn’t know how to do that process. Please, any help.

• It hard to be sure if I understood correctly the properties you expect, could you give a piece of code that checks if a given matrix has the property you want?
– Bob
Commented Mar 21 at 15:45
• @Bob this is the issue I face, I couldn't write that code, but what i want is the matrix 'W22' is unitary, means that $W22 \times W22'$ give a diagonal matrix, and the second condition the matrix 'T' has non-zeros values only in first columns, for example the first 8 columns are any values which might be different from zeros while the other columns are zeros. Commented Mar 22 at 2:55

## 1 Answer

Your condition is $$W_{2,2} W_{2,2}^T = I$$

$$T = W_{2,2}^{-1} W_{2,1}$$

If $$T$$ has non-zero elements only in the first collumn it means that $$T = \begin{bmatrix} \textbf C & \textbf 0_{P \times (P-r)}\end{bmatrix}$$ where $$\textbf C$$ is a $$P \times r$$ matrix.

For any $$T$$, it is straightforward to compute $$W_{2,1} = W_{2,2} T$$. One property of $$W_{2,1}$$ is that it also will have non-zero elements only in the first column, and is given by $$W_{2,1} = \begin{bmatrix} W_{2,2}\, \textbf C & \textbf 0\end{bmatrix}$$

• Yes, but it's not necessary that $c$ is single columns matrix, it could be more than one one column. Second, $W_{2,2}$ and $W_{2,1}$ are taken from the Hadamard matrix so I need to optimize the optimal submatrices that achieve those conditions. Commented Mar 23 at 6:39
• sorry, I read "first column" where you wrote "first columns" but that doesn't change the procedure. There is nothing to optimize, if the Hadamard matrices are fixed, and we have a closed solution to your problem, the only variables you have to choose are the elements of $\mathbf c$
– Bob
Commented Mar 24 at 8:04