The previous answer is completely correct, but I interpret the question a little differently - rather than how to calculate the matrix, which of the matrices is correct?
Short answer: Wikipedia is wrong (and has since been corrected).
Longer answer:
I will assume we are talking about CIE RGB space (and not a display color space - the previous answer covers that well). If that's the case, then the issue is with that funny value of (1/0.17697).
Two similar, but in some ways importantly different, types of perception measurements were done in the late 1910s and early 1920s. The first are the famous Guild and Wright experiments, color matching the spectral colors with three spectral primaries (red, green and blue). The second type of experiment was measuring the sensitivity of the eye to different wavelengths of light. This was done for both day and night vision, but only the day vision is important here. This gave a bell-shaped function.
The data from Wright and Guild were combined mathematically, giving three color matching functions (one each for red, green and blue). These three functions were normalized such that the areas beneath the curves were the same. Meanwhile, the intensity data from the second type of experiment were also normalized, in this case such that the maximum value (around 560 nm, I can't recall the exact value) was set to 1.
Now comes the rub. It seems useful that the two types of functions (color matching and perceived intensity) should somehow be made to be mathematically related to one another. It seems obvious, to me, that this should be done by scaling the r(lambda) g(lambda) b(lambda) functions such that their areas equaled the area under the intensity curve (note: the symbols r g b should each have a hat, but I can't figure out how to format that). However, the CIE went a different route - they set the value of the r(lambda) function at 700 nm to be equal to the value of the intensity function at 700 nm. I wasn't around at the time, but I assume this made sense in some way that I just can't see - I'm guessing that it might have to do with the fact that only one type of cone cell in the eye (the L cell) absorbs this wavelength.
As a result, the areas under the r(lambda) g(lambda) b(lambda) curves did not come out to some simple value like 1.0, but instead were off from that by a factor of 0.17697. It would be useful that the R G and B tristimulus values for illuminant E (equal intensity across the visible spectrum), would be 1 (or 100), so when calculating these tristimulus values from the color matching functions, the R G B values were all scaled by this amount.
When developing XYZ color space, the CIE decided (and I agree) that it would be better if the areas under the curves (and so the tristimulus values of illuminant E) came out to 1 (or 100, depending on whether you like fractions or percentages), and so this value of 0.17697 came back into play. (the main benefit of doing this is that the y(lambda) function could be exactly equal to the perceived intensity function, rather than off by some factor).
The overall effect was that when converting from the r(lambda) g(lambda) b(lambda) color matching functions to the x(lambda) y(lambda) z(lambda) color matching functions, you had to include the factor of 0.17697. However, when converting between tristimulus values R G B to tristimulus values X Y Z, we don't use this factor because it is already "baked in" to the R G B values, since that factor was used to make the R G B values be 1.0 (or 100) for illuminant E.
This leads to a great opportunity for confusion, as evidenced by the fact that the Wikipedia matrix was incorrect for several years, but at least we can see where that funny factor comes from and where it is, and is not, needed.