I have the following system of equations (taken from this wiki page https://en.wikipedia.org/wiki/YUV#SDTV_with_BT.601), and I am trying to understand how they convert this:
$W_R = 0.299$
$W_G = 1 - W_R - W_B$
$W_B = 0.114$
$U_\max = 0.436$
$V_\max = 0.615$
$ $
$Y' = W_RR + W_GG + W_BB$
$U = U_\max \frac{B-Y'}{1-W_B}$
$V = V_\max \frac{R-Y'}{1-W_R}$
Into the matrix:
$$ \left[ \begin{matrix} Y'\\ U \\ V \\ \end{matrix} \right] = \left[ \begin{matrix} 0.299& 0.587 & 0.114 \\ -0.14713 & -0.28886 & 0.436 \\ 0.615 & -0.51499 & -0.10001 \\ \end{matrix} \right] \left[ \begin{matrix} R\\ G \\ B \\ \end{matrix} \right] $$
I can see how the $Y'$ row is constructed by simply moving out the coefficients, but no amount of simplification that I am able to understand has helped me in re-arranging the $U$ and $V$ equations to similar effect.
I tried breaking the $Y'$ constant in the $U$ equation back into its component pieces, and then simplifying (through wolfram alpha) gave me:
$U_\max \frac{B - (W_RR + W_GG + W_BB)}{1-W_B}$
Which I re-arranged to the following:
$(-RU_\max W_R) + (-GU_\max W_G) + (-BU_\max W_B) + (BU_\max) + (-U_\max W_B)$
Which allowed be to remove the $R$ and $G$ components, but I don't know how to then remove $B$. I'm sure I'm not doing things correctly.
Can anyone offer any assistance?
Thanks
With a little help from the above posters (and a quick maths lesson from @quick7silver ), I realised where I was going wrong. My initial problem wasn't quite as I had described, as I also wanted my result matrix to incorporate the original variables (as I was transcribing the formula into a computer program), which meant I couldn't perform the initial variable substitution which greatly simplified the problem for the other answerers.
My final working for $U$ was as follows:
$U = U_\max \frac{B-(W_RR+W_GG+W_BB)}{1-W_B}$
$\phantom{U} = U_\max \frac{B+(-W_RR-W_GG-W_BB)}{1-W_B}$
$\phantom{U} = U_\max \frac{-W_RR - W_GG + (1-W_B)B}{1-W_B}$
$\phantom{U} = \frac{U_\max}{1-W_B} -W_RR-W_GG+(1-W_B)B$
$\phantom{U} = \frac{U_\max.-W_RR}{1-W_B} - \frac{U_\max.W_GG}{1-W_B} + \frac{U_\max.(1-W_B)B}{1-W_B}$
$\phantom{U} = -U_\max\frac{W_RR}{1-W_B} - U_\max\frac{W_GG}{1-W_B} + U_\max B$
Which when incorporated into the final matrix: $$ \left[ \begin{matrix} W_R & W_G & W_B \\ \frac{-U_\max W_R}{1-W_B} & \frac{-U_\max W_G}{1-W_B} & U_\max \\ V_\max & \frac{-V_\max W_G}{1-W_R} & \frac{-V_\max W_B}{1-W_R} \\ \end{matrix} \right] $$
Thanks a lot for all your help!