Why both yellow and purple light could be made by a mix of red, green and blue? We see the mix of red light and green light as yellow light (#FFFF00). The wavelength of yellow light lies between red and green.

But the wavelength of purple light lies outside of red and blue. Why can we also see the mix of red and blue as purple? Is it real purple? 
 A: The reason that colors combine as they do has everything to do with the response curves of the light-sensitive proteins in your eye. A response curve is just a function that tells you how strongly a particular protein reacts to a fixed amount of light a given frequency (or energy). There are three kinds of these photosensitive proteins (photopsins) in our eyes, one for each of the three different kinds of cones on the retina, and each has a distinct response curve, which you can see e.g. in this image on Wikipedia:

When light of a particular frequency comes into the eye, it triggers a certain strength of reaction from each of the three kinds of proteins. For example, light with a wavelength of 580 nm causes the "short" protein (the one that responds most strongly to short-wavelength light) to produce a signal of strength 0.000109, the "medium" protein to produce a signal of strength 0.653274, and the "long" protein to produce a signal of strength 0.969429. It's this set of signal strengths, (0.969429, 0.653274, 0.000109), that triggers the perception of that particular shade of yellow in our brain. (Numeric data come from this site)
But as you might guess, it's possible to "fake" this signal by sending a particular combination of different frequencies of light. For example, you might guess that if you send a combination of 97 parts long-wavelength light and 65 parts medium-wavelength light into the eye, it would produce almost exactly the same set of signal strengths: (0.97, 0.65, 0). In practice you have to be a little more careful than that, because the response curves overlap a bit, but the basic idea that a combination of multiple wavelengths of light can produce the same signal as a single, other wavelength of light, definitely works.
This is why red and green combine to produce yellow, for example. It's not because yellow is between red and green in the spectrum, it's because the signal strengths generated when our eye receives yellow light are very nearly the same as the signal strengths generated when it receives a certain combination of red light and green light. Similarly, the signal strengths generated when our eye receives purple (actually violet) light are very nearly the same as the signal strengths generated by a certain combination of red light and blue light.

The above is adapted from a comment I posted on Reddit, and for more information, you might want to look at an earlier comment describing how wavelengths of light (or combinations of wavelengths) get converted to colors.
A: Ever since Newton split white light and saw seven color bands that he identified with musical notes, people have attached mystical significance to the spectrum, even suggesting that the non-spectral hues are "unreal" just because they can't be produced by monochromatic light.
For the purposes of this question, I think the spectrum is irrelevant.
The whole neurological part of our visual system has nothing to work with but the firing rates of the cones. It doesn't know anything about frequencies of light; it doesn't know, for example, that the cone types have a linear order by peak frequency (L-M-S). It just has the firing rates of the three cone types, which you can think of as coordinates in a 3-dimensional space.
The visual system transforms to a different coordinate system for that space, whose axes are light-dark, red-green, and blue-yellow. This transformation is complicated: it's nonlinear, and depends on a dynamically adjusted white point. I think that the reasons why we use these particular primaries are largely unknown. It's widely claimed that the red-green axis is for recognizing fruit. Primary blue seems to perfectly match the color of the sky, but it's not clear why that would be advantageous. (Why is the sky blue? We don't know.)
If you ignore light-dark and just plot red-green versus blue-yellow, you get a color wheel, with grey in the center, the four primary hues in four directions outward from grey, and intermediate hues in intermediate directions.
If you draw the perceived colors of monochromatic light on this wheel, you get a meandering curve that crosses a large part of the wheel, but doesn't close on itself (since there's no reason why it would) and therefore misses some hues. The endpoints of the curve aren't at primary colors: one end is between red and yellow, the other between red and blue. That's because the ends don't matter. If it were useful to recognize the highest and lowest visible wavelengths of light, then they would be at primary colors, but it isn't, so the primary colors are assigned to more important things. The rest of the curve doesn't matter either (to the visual system). Monochromatic light doesn't occur in nature, for the most part, and there isn't any adaptive value in recognizing it. The color bands in a rainbow are a meaningless side effect of a visual system that evolved for other purposes.
So the reason that red and blue can combine to make violet is that violet is between red and blue on the wheel, and the reason that violet is also the hue of the shortest wavelength of visible light is that the meaningless short-wavelength end of the spectrum happens to fall there. There's no deeper reason.
I think some of the confusion is due to people believing that the color wheel is related to LMS cone firing rates in a simple way. For example, many people believe that the cone responses are RGB, or that the red-green axis is L−M and the yellow-blue axis is (L+M)−S. If that were true, then the L cone would have to have a second peak in the violet to explain why violet has red in it. But it isn't true, and there is no second peak. (If you see a second peak, you may be looking at in-vitro measurements that don't include the absorption of low wavelengths by the lens, or you may be looking at a mislabeled graph of the XYZ color matching functions.)
A: Disclaimer: I know nothing about all this. But I have two obvious observations.
If the 3 cones in our eye are built to trigger on specific frequencies, it makes sense to assume that the cone for red, which would trigger at ~ 440thz, would also trigger a bit at 220thz and 880thz. 
It does not, because those are outside our visual range (in fact, it's the lens that blocks UV, I read). But you could imagine 'ultra red' being virtually at 880thz, and between that and blue, there's purple. 
I suppose the better answer is mixing two nice and clean waveforms doesn't produce a third nice and clean waveform in another frequency, it produces some combined wave, and our three types of cones are left wondering just how much it tickles. And red and blue mixed just tickle as if it's a higher frequency - purple. Note: it IS not pure spectral purple - it would be more something like this, theorectically, before it hits the eye:

