# How do we find the exact temperature of a star/galaxy?

This is a very basic question, but I am a little confused. As far as I know, the temperature of a star is analyzed based on the color of the light it emits. So, if a star is moving away from us, then the light emitted by it will be redshifted(or if it is stationary with respect to us and the light undergoes gravitational redshift), then how do we know the exact temperature of that star or any other object because it is possible that we observe red light but actually the star might be emitting yellow light.

-
I think you are answering yourself. Given that we understand photon redshift then it is just a matter of considering those effects in the calculation for the real colour and eventually arrive to the temperature. –  harogaston May 7 at 9:58
@harogaston But for removing the error due to red shift, you first have to know that you are seeing red shifted light. –  Yashbhatt May 7 at 12:19
Every light wave coming from a galaxy not belonging to our cluster will be redshifted. So you know that what you are getting is redshifted light. Then you can calculate the distance to the galaxy/star you are observing and from there its relative velocity and so you can have an estimate of the redshift effect in your signal. Then apply the corrections to get its real temperature. –  harogaston May 7 at 20:24

Spectral lines occur at defined wavelengths. By their redshift you can calculate the radial velocity (or gravitational redshift) of the star, or the absorbing medium, and hence the amount you've to shift the black body radiation to obtain the surface temperature (and the radial velocity of a possibly absorbing medium between the star and Earth).

Schematic example: Assume, you measure the following two stellar spectra, and you're able to identify the typical H-alpha spectral emission line. This line should be at 565.3 nm:

In the second spectrum, H-alpha is at the correct position: no redshift. In the first spectrum, it's redshifted (towards longer wavelength).

Although the measured intensity may be the same elsewhere in the spectrum, you'll know, that the first spectrum is of a hotter star, since the maximum intensity (besides the H-alpha line) is left (towards blue) of the H-alpha wavelength, whereas the maximum intensity in the second spetrum is right (towards red) of the H-alpha line.

Both stars would look reddish, but the first one is the hotter one, and it's redshifted, either due to Doppler shift, due to gravity, or due to cosmic expansion.

-
I read that article on spectral lines but still din't get it. Let us suppose that I note down the spectrum of a star. Normally, there should be a peak at blue but now the star starts moving away at a constant speed and as a result there's a peak at yellow. So, won't there be an error in calculating the temperature? –  Yashbhatt May 6 at 14:02
See the third answer here. Is that what you are trying to say? –  Yashbhatt May 6 at 14:04
@Yashbhatt I've added a link to black body radiation. Stars roughly emit black body radiation. From the intensity maxium you can conclude the temperature. The spectral lines tell you, how much you have to shift the measured curve to get the emitted curve. Details may be more complicated, but that's the principle. –  Gerald May 6 at 22:49
@ Gerald I understood that this method is used for finding out the temperature of stars but what about galaxies? They are not made up of a single element. So how do we know how much the spectra is shifted? Do we do something like averaging the temperatures of all the stars in the galaxy or something like that? –  Yashbhatt Jun 15 at 15:02
I understood how we use it to calculate temperatures of stars. But what about galaxies/ They are mixture of so many elements. How do we know how much the spectra is shifted? Do we do something like averaging th temperatures of all the stars in the galaxy? –  Yashbhatt Jun 15 at 15:21