matrices – How to design a matrix function to meet the following conditions

Suppose I have a matrix $Xin mathbb{R}^{ntimes n}$, such that

  1. $X$ is symmetric
  2. Do not know the rank

I want design a matrix function $f(X,Q)in mathbb{R}^{ntimes n}$ with $Q = qq^T$ and $qin mathbb{R}^n$, such that

  1. $f(X,Q)$ is symmetric
  2. $text{tr} (f(X,Q))=0$
  3. rank$(f(X,Q))$ is $2$.


  1. we can design $QX+XQ$
  2. I only know the property $Omega Q + QOmega^T$ with $Omega$ a skew-symmetric matrix (since tr$(QOmega)=q^TOmega q=0$.
  3. Choose $f(X,Q)=QX+XQ$. The basis for its column space is ${q, Xq}$

However, I have no idea how to combine all of them. Can anyone help me this?

Sincerely appreciate this help.