title: What is the relationship between color space RGB, XYZ and the color matching function?
body: <p>What is the relationship between color spaces (RGB, XYZ) and the color matching function? Let's say we have some color matching function in the color space XYZ (3 row matrix). We also have the transformation matrix which translates from XYZ coordinates to RGB coordinates. </p>
  
  <p>My understanding is that there is some visual input, which is made up of the color spectrum S(y). The human eye does not see the world - it only sees its interpretation of the world. The human eye has 3 cone types LMS, each of which is responsible for processing RED, GREEN, or BLUE. The human eye sees the spectral color only because it's eye sums over RED, GREEN, BLUE vector, and this sum matches the color of the input. In order to match the color, there is a color matching function, which takes the input spectrum and produces the weights by which to multiply the primary RED, GREEN, BLUE color vector. These then get added and their output visually matches the spectral input, even though the spectrum had many many frequencies added, while the human eye was only adding 3. So we went from HUGE space to space where we can describe all with 3 vectors, summed as dictated by the color matching function.</p>
  
  <p>The spectral input, color primaries, and color matching functions behave as described above and can be summarized in this formula:</p>
  
  <p><a href="https://i.stack.imgur.com/wv6O6.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wv6O6.jpg" alt="how primary color is summed with weights produced by the color matching function"></a></p>
  
  <p>where pi is the 3d vector of primary colors, c - color matching function is also a vector of 3 components, and finally s is the spectral input.</p>
  
  <p>We have XYZ color space, and a corresponding color matching function which does what is described above. We are then given matrix T, which transforms XYZ coordinates to RGB coordinates. We already know T, and we need to use it to produce a new color matching function for the RGB color space.</p>
  
  <p>I do not understand how the color space relates to choice of primaries pi(λ) and the choice of color functions ci(λ1).</p>