Although mainly hydrogen, the composition of stars can vary quite a bit from star to star. It depends on what materials were around during the formation of the star that determines the composition, which would have been dictated by what had been there previously.
Large stars with high masses have relatively short life spans, but towards the end of their life they enter into phases where heavier elements are used as fuel, producing heavier elements still. When the die, there is a supernova explosion. The heat and pressure during this time is so immense that the heaviest elements form through fusion.
The mixtures of elements left over from such events will spread out and become part of new solar systems, when new stars beginning to form. The different concentrations of elements will give us stars of varying compositions.
Although mainly hydrogen, the composition of stars can vary quite a bit from star to star. It depends on what materials were around during the formation of the star that determines the composition, which would have been dictated by what had been there previously.
Large stars with high masses have relatively short life spans, but towards the end of their life they enter into phases where heavier elements are used as fuel, producing heavier elements still. When the die, there is a supernova explosion. The heat and pressure during this time is so immense that the heaviest elements form through fusion.
The mixtures of elements left over from such events will spread out and become part of new solar systems, when new stars beginning to form. The different concentrations of elements will give us stars of varying compositions.
Many stars are composed of helium (27%) and hydrogen (71%) and some other elements (2%)
A star is made up of mostly hydrogen and some helium. As the star fuses more elements, there could also be heavier elements (such as oxygen, magnesium, and iron) in the star.
Spectroscopy. Each element has a characteristic set of lines that appear in the spectrum. Sodium, for example, has a pair of orangish-yellow lines close together; other elements do not have lines at these same frequencies. So, by looking at the spectrum to see what lines show up, we can tell what elements are there; from the intensity, we can estimate how much is present. This is how helium was first discovered: scientists looking at the spectrum of the sun noticed lines which did not correspond to any known element, and concluded that they must be due to the presence of an unknown element, which they called helium.
This is an interesting question.
In the early universe, a few seconds after the big bang is thought to have happened, when everything had cooled down only hydrogen and helium could form. As the temperature dropped and gravity had more influence on the matter left after the big bang the gases began to clump into clouds and started getting denser.
As the density went up the attractive forces between the particles become stronger and the density increased, causing more colisions between particles releasing energy until the collisions became so frequent that the whole cloud of gas ignited in a glorius nuclear fusion reaction. Thus the first generation of stars were born.
Depending on the size of the star different levels of nuclear fusion can be sustained (up to iron), so in early stars the composition would change from simple hydrogen and helium to higher elements dependant on the size of the star (the bigger the star, the higher the elements - again up to iron). Some of these stars eventually became unstable and either collapsed (into a black hole or white dwarf) or exploded becomeing a supernova and scattering its contents in a spectacular dust cloud. At the centre of this dust cloud there is a massive implosion and all this extra energy leads to fusion reactions creating even higher elements (everything above iron).
This dust cloud eventually starts to get clumpy again and the density in some regions increases, leading to the birth of second generation stars and planets (planets cannot form around first generation stars because there was only hydrogen and helium when they formed). So if a small star contains elements it could not have created itself we know it must be at least a second generational star - since the only way that star could contain those elements would be if it was formed from the debris of a supernova*.
* On the 21st September 2006 it was observed that a supernova had formed from the collision of two white dwarfs[1]. The discovery was called a "champagne supernova" after the song by the British band Oasis. So exploding star supernova is not the only way debris can be scattered to form planets and stars.
So, in summary, the composition of a star depends firstly on its size, secondly on if it is a second or third generation star and finally how big the previous generations supernovae were from which the star was born.
I realised as I checked this post for errors that you may have meant "How is it that we determine a star's composition?"
The answer to this is spectroscopy. Every element emits a specific spectrum of light frequencies, it's like a finger print. We point spectroscopes at stars and judge their contents using the data.
A large number of elements on the Periodic Table were discovered this way. Which is why you don't see them in the lab!
I hope this answers your question!
References
[1] - www.nature.com, "SNLS-03D3bb" Supernova
Mostly by spectrographic observation.
Every distinct element radiates exact and specific frequencies of light. By taking a tiny sample of the element and heating it to "glowing hot", we can measure the spectrum of the light that this element gives off. This is how a spectrometer works.
In a star, the elements are already at thousands of degrees, so all astronomers need to do is to analyze the spectrum; most stars have spectra that are as distinct as fingerprints to people. We can determine what elements are present, and in what proportions, with considerable accuracy.
A simple search on Wikipedia for 'star' will get you the answer you are looking for.
Spectroscopy. This is a study of the light from the star which is characterised by the elements that are present.
The composition of a star is determined using an instrument called spectroscopy
They are mostly made of Hydrogen, with Helium being second, and Lithium being 3rd.
spectra
No, how a star dies is determined by its mass.
binary star systems
Several chemical properties can be estimated knowing the chemical composition.
Its temperature.
Yes, the composition of a star can be determined by analysis of its color, which would be described scientifically as spectrographic analysis.
The colour of the star is determined by its age , mass , and composition.
spectrophotometer or laser spectroscope
Analyzing its a light with spectroscopy
The color of a mineral sample is determined by its chemical composition
spectra
The composition is determined by spectral analysis.
No. The color is determined by the star's temperature, not location.
Ocean topography has been determined through sonar detection.
No, how a star dies is determined by its mass.
The composition of inks is determined.
Binary stars are ideal to determine the mass of the components.