system
Given the following post, respond as if you're commenting on Reddit:
human
How do the scientists estimate mass of galaxies based on their brightness and colour?

I've recently watched YouTube video called Dark Matter's Not Enough by The Royal Institution and I heard there the explanation of dark matter. Presenter said that dark matter idea came from discrepancy between two estimates: there seems to be 5x more mass in galaxies based on their rotation speed than when estimating mass based on their brightness.  I know a little bit of science and I could image measuring mass based on rotation speed but you would need to know how large that galaxy really is, so that I imagine is a bit of a challenge.
The bit that blew my mind was estimating galaxies mass based on star brightness. How such thing can even be possible and how can estimate measurement error for that? 
The 5x times discrepancy suggest to me that there might be huge error in there that is not accounted for, meaning that measurement may be incredible inaccurate.
gpt
So the vast majority of normal (baryonic) matter is contained within stars, and obviously stars give off light. We can work out the ratio of how much mass a star has compared to how much light it gives off - this is called the mass-to-light ratio. For example, our Sun is a fairly typical star and has a mass-to-light ratio of  5133 kg/W. 

This ratio differs depending on the exact size and composition (stellar class) of the star, but the figure above gives a reasonable "average" value for a population of stars. Therefore if you measure the brightness of a galaxy, you can then work out the mass by simply multiplying by the mass-to-light ratio. As to the errors in this calculation, I'll have to defer to someone more knowledgeable.