# How to find a positive semidefinite matrix $Y$ such that $YB =0$ where $B$ is given

$B$ is an $n\times m$ matrix, $m\leq n$. I have to find an $n\times n$ positive semidefinite matrix $Y$ such that $YB = 0$. Please help me figure out how can I find the matrix $Y$.

-
How about letting $Y$ be the zero matrix? – Gerry Myerson Jun 16 '11 at 7:13
Yeah. It will be the simplest case, but I need a generalized method. – Fatima Tahir Jun 16 '11 at 7:52
Do you mean you want to find all the positive semidefinite matrices $Y$ so that $YB=0$? – mac Jun 16 '11 at 8:25
@mac: No I need not to find all such matrices. But I just want to have at least one nn Y such that it is positive semidefinite and YB=0 for any given nm matrix B. – Fatima Tahir Jun 17 '11 at 1:10
@Fatima: should $Y$ be non-zero? (See Gerry's answer). I suggest you add this requirement to the question if that's what you mean. – mac Jun 17 '11 at 7:19

If $X$ is any (real) matrix with the property that $XB=0$, then $Y=X^TX$ will do the trick. Such a matrix $Y$ is always positive semidefinite. To see this note that for any (column) vector $v$ we have $v^TYv=(Xv)^T(Xv)=|Xv|^2\ge0$.

How to find such a matrix $X$? If $m=n$ and $\det B\neq0$, then there is no other choice but $Y=0$. Otherwise we can do the following. The rows of $X$ should be orthogonal to the columns of $B$. Let $v=(v_1,v_2,\ldots,v_n)$ be a vector of unknowns. From our assumptions it follows that the homogeneous linear system $B^Tv=0$ has non-trivial solutions: either $m<n$ or there are linear dependencies among the equations as $B$ has rank $<n$. Let $U$ be the set of solutions (use whatever methods you know to find a basis for $U$). Then any matrix $X$ with row vectors that (or rather their transposes) are from the space $U$ will work.

-
What is Beni Bogosel's solution? – Fatima Tahir Jun 16 '11 at 7:55
What is Beni Bogosel's solution? – Fatima Tahir Jun 16 '11 at 7:57
@Fatima: Sorry I got wrapped up in an editing loop. You can use Beni Bogosel's answer to get a non-zero matrix $X$, iff the rank of $B$ is exactly $n-1$. I was trying to build from there, but realized more work was needed to cover the general case. – Jyrki Lahtonen Jun 16 '11 at 8:09
Thank you so much for your kind help and suggestion. – Fatima Tahir Jun 17 '11 at 0:51

I can give you the answer in the case $m=n$.

• if $\det(B)\neq 0$ then $B$ is invertible, and therefore the only matrix $Y$ is $Y=0$.

• if $\det(B)=0$ then take $Y=adj(B)$, where $adj(B)$ is the adjugate matrix of $B$.

Oops... I forgot about the fact that $Y$ must be positive semidefinite. Sorry.

-
But in my case, m and n are not always equal. – Fatima Tahir Jun 16 '11 at 7:57
I know that, and I mentioned it in the beginning of the answer. Sorry about that. – Beni Bogosel Jun 16 '11 at 11:49
No problem. Anyways, thank you so much for your concern and kind help. – Fatima Tahir Jun 17 '11 at 1:06

Use Singular Value Decomposition! Note $YB=0$ implies each row of $Y$ is in the left null space of matrix $B$. SVD is a good tool to find the left or right null space of a given matrix.

Let $r$ be the rank of matrix $B$. Then an SVD of $B$ is like $$B=U\Sigma V^T$$ where $U=(u_1,...,u_{r-1},u_r,...,u_n)\in\mathbb{R}^{n\times n}$ and $V\in\mathbb{R}^{m\times m}$ are orthogonal matrices.

It is easy to check $u_i^TB=0$ for $i=r+1,...,n$. Choose $U_1=(u_{r+1},...,u_n)^T\in\mathbb{R}^{n-r\times n}$, then $U_1B=0$. Choose $Y=U_1^TU_1\in\mathbb{R}^{n\times n}$, then $Y$ is a positive semidefinite matrix with rank as $n-r$ and $YB=0$.

-
Thank you so much for your kind help and suggestion. – Fatima Tahir Jun 17 '11 at 1:02
Thank you so much once again. For me, it is the most easy way to find such matrix Y. – Fatima Tahir Jun 17 '11 at 1:23