so wrt rgb that gets into how the human eye perceives things. you should take a look at the frequency response curves of the eye's various types of rods and cones - you'll find plots if you search around. they don't precisely correspond to red, green, and blue as monitors emit them, but they are close enough that it mostly works.
the deep secret that would make a lot of color theory easier to understand if people said it up front is that combining different frequencies of light does NOT make any color. it just fools the eye into thinking it's seeing any color, because the eye has its own "hardware" limitations.
we saw a really good essay a while back on the manner in which magenta fails to exist, which is unique and different from other weird colors such as orange, which also doesn't exist but in a totally different way (and perhaps a less fascinating one). magenta is amazing in that it is not a frequency of light at all, it is TWO frequencies of light that the brain understands to mean something different when they're together, in fact at the neurological level it's subtracting one signal from another to decide "how magenta" things are. because evolution doesn't care what we think makes sense ;)
the answer to the question you actually asked is a bunch of matrix multiplication, and matrices are just a fancy notation that means multiply your equation by all these constants, so you can and should look up directions for how to do it and you'll get the constants that people (mostly camera and printing companies) have decided on, but that won't leave you very enlightened by itself. you should still do it in order to convince yourself that that's ALL that's happening, that all this theory does come down to these multiplications. because it does.
for the record we taught ourselves this shit (and lots of other shit) instead of being a normal highschooler, and it was very rewarding and the understanding we got that way was way deeper than most people's, on pretty much every topic, and it has been the foundation of our career and we attribute a ton of our success to it
it sure did lead to us failing all our classes though, so there's that. you'll have to strike your own balance