It is said that red, blue and yellow are the 3 primary colors, which can't be formed by any other color.
Then how come we create yellow color in RGB color model?
Is there any theory or reason behind this?
Yes the human color vision is based on 3 color sensors. If we simplify things to bare basics then it goes like this:
Our brain then processes this information and simply shows a mixture of red and green as yellow. Likewise red and blue as magenta*. Ok so that explains the RGB colors.
Or what is usually taught out as Red, Blue & Yellow is actually the inverse of RGB. See when light hits the paper you actually see the photons that the paper did not absorb. So Cyan is just a color that eats up all red colors, so absence of red.
This is called a subtractive color model. In reality there's no such thing, just that its easier to conceptually think when the color is reflective. All color that you see is from a additive color just the difference is where the light comes form the medium or another source.
In reality is much more complicated.
Image 1: human color receptors. Image courtesy to Wikipedia
* Magenta color does not actually exist, in the spectrum. There is no magenta color in light its just the mixture that our brain shows it as magenta.
It is said that Red, Blue & Yellow are the 3 primary colours
Yes it is said but it is wrong. The Red Blue Yellow is an unacurate historical model.
The 3 primary light colors are Red Blue and Green.
When you use a paper or a canvas you can not emit light, so you use the complementary color model that is the subtractive model, so the secondary colors become the primary pigments. Cyan, Magenta, and Yellow.
I'm making this image darker simulating a print, becouse it is harder to achive bright colors on a print:
Both color models are in fact the same. One 3D representation is a cube, that contains all colors. But you can rotate the cube and use it as a basis for this 2D circles I showed.
Here is my explanation on why the RYB model is inacurate.
Yes you will see that it has some downvotes... That is interesting.
Red, Blue, and Yellow are used for pigment when you print or mix colours. Actually, technically, we use CMYK, Cyan, Magenta, Yellow, and Black, but that's besides the point.
Light itself is actually made up from Red, Green, and Blue. Since you're using a computer the screen uses, essentially, red, green, and blue lights to form the colours you see. Hope that helps.
The simple answer:
When mixing pigments, you are using the subtractive color model. Blue, Red and Yellow are the primary colors in that color space.
When mixing light, you are using the additive color model. Red, Green and Yellow are the primary colors in that color space.
The accuracy of the "Blue, Red and Yellow" primary colors in the subtractive color space is definitely debatable. Most would agree it's not that accurate. But for the sake of this question, the answer is "Because the primary colors are different in each color space."