# To orthogonalize a matrix with respect to a vector(?)

I'm developing a code to perform Mie scattering corrections and, while reading a paper regarding this [1], I found this sentence:

Prior to approximation by PCA, the matrix $M$ is orthogonalized with respect to the reference spectrum $Z_{ref}$

where $Z_{ref}$ is a vector of data.

The matrix $M$ has a spectrum of data in every row, so I thought that perhaps they mean to orthogonalize each row of $M$ with respect to $Z_{ref}$, because an orthogonal matrix is a square matrix $Q$ such that $Q^T = Q^{-1}$, and this does not depend on any vector.

Even if they refer to this, I don't know what would be to orthogonalize a vector with respect to another neither (of course I know what are two orthogonal vectors but not sure about what they mean orthogonalize). Any thoughts?

Sorry if this question does not fit here.

1. Konevskikh, Tatiana, et al. "Mie scatter corrections in single cell infrared microspectroscopy." Faraday discussions 187 (2016): 235-257.
• Possible better homes for this question are Mathematics, Cross Validated, or possibly Computational Science. Mar 3, 2017 at 14:51
• (For future reference, folks tend to frown on cross-posting, particularly with simultaneous posts. If you do do it, always link all versions to all other versions, ideally within the post as a footnote, for clarity. No sweat this time, though ;-). ) Mar 3, 2017 at 16:09
• Hi stat.se mods: Please merge posts.
– Qmechanic
Mar 3, 2017 at 18:39

I have found the solution. It's similar to the answer of @Daddyo but with some additional things. I just have to take each row $Q$ of the matrix $M$ as a vector and calculate its projection in the plane normal to the vector $Z_{ref}$. This is done with the following expression, where $Q^*$ is the orthogonalized row.

$$Q^* = Q - \dfrac{Q \cdot Z_{ref}}{\| Z_{ref} \|^2} Z_{ref}$$

If you compute the scalar product between $Q^*$ and $Z_{ref}$ you see that they are orthogonal to each other.

$$Q^* \cdot Z_{ref} = Q \cdot Z_{ref} - \dfrac{Q \cdot Z_{ref}}{\| Z_{ref} \|^2} (Z_{ref} \cdot Z_{ref}) = Q \cdot Z_{ref} - Q \cdot Z_{ref} = 0$$

It sounds as if they want to detect dominant trends in the data that are not similar to Zref. You can do that by removing any trace of $Z_{ref}$ from each of your spectrums.

You can make row 1, call it $M_1$, orthogonal to $Z_{ref}$ by subtracting $Z_{ref}$, scaled by the dot product of $M_1$ and $Z_{ref}$, from $M_1$. So your new orthogonalized row , call it $M_1^*$, would be $M_1^* = M_1 - (M_1 \cdot Z_{ref}) Z_{ref}$. The new row, $M_1^*$, is orthogonal to $Z_{ref}$.

If you repeat that for every row, then each of your spectra will be cleansed of components of $Z_{ref}$ in them.

• Actually this only works when $Z_{ref}$ is unitary. You have to divide between the squared norm in the dot product.
– ruli
Mar 21, 2017 at 10:01