What is the temperature of the solar atmosphere (the corona) and how is it measured?

The temperature of the Sun's atmosphere, also referred to as the solar corona, is known to be hot even hotter than the Sun's surface. What is its temperature and how is it measured? How does it compare to other stars and how does it vary across the Sun?

This is a rather broad question and this will not be a fully comprehensive answer.

There is no single temperature to the solar corona. The coronal temperature varies by an order of magnitude from place-to-place. It is hottest ($\sim 10^{7}$ K) in magneticloops undergoing flares, which tend to be anchored in low latitude regions. It is coolest (a bit less than $10^{6}$ k in coronal holes which are usually at high latitudes. It is hard even to come up with some average number, because it is not altogether clear how the various pieces should be weighted in any average. It is also cyclic - in that magnetic activity, and average coronal temperatures vary with all the other magnetic phenomena on the Sun with a roughly 11-year period. If you weight it by emission measure, which is density squared times volume, then the solar corona is between $10^{6}$K at solar minimum to about $3\times 10^{6}$K at solar maximum.

The temperature of coronal plasma can be measured using X-ray spectroscopy. If you assume that the plasma can be represented by some equilibrium temperature, then you can make a prediction of what the X-ray/EUV spectrum will look like. To some extent the spectrum will also depend on the composition of the plasma and also on its density, but these produce comparatively minor differences compared to changes in temperature and can be simultaneously estimated in most cases.

For stars you essentially do the same thing but with worse data. Here you are getting some sort of average temperature for the whole corona - there is no spatial resolution. X-ray satellite observatories like Chandra and XMM-Newton have grating spectrographs and detectors with energy sensitivity that can record X-ray spectra from stars. You then use software like XSPEC along with an optically thin plasma model, such as that of Mewe-Kaastra-Liedahl, (and not forgetting to include absorption by the interstellar medium) to get the best fitting temperature for the measured spectrum.

As far as how the Sun compares with other stars, an excellent starting point is the review by Guedel (2007). A short summary would be that the temperature of a stellar corona depends on it's rotation rate - the faster it rotates, the hotter it is. Because (single) stars lose angular momentum and hence rotate more slowly as they age, then both X-ray luminosity and (average) coronal temperature decrease with age.

Telleschi et al. (2005) studied solar analogues at a variety of ages. They found a relationship that the average temperature $$\langle T \rangle = 1.16\times10^{7} P_{\rm rot}^{-0.48}\ {\mathrm K},$$ where the rotation period $P_{\mathrm rot}$ is in days.

Given that rotation period and age are linked by a "gyrochronology" relation roughly of the form $P_{\rm rot} \simeq 27 (t/4.5\ {\rm Gyr})^{1/2}$, for $t \geq 100$ Myr, this means that $$\langle T \rangle = 2.4\times10^{6} (t/4.5\ {\rm Gyr})^{-0.24}\ {\mathrm K}.$$ At ages below 100 Myr, the coronae "saturate" at the luminosity and temperature of a 100 Myr star.

In general, stars with photospheric temperatures cooler than the Sun tend to have hotter coronae, whilst those with warmer photospheres have cooler coronae. Stars with spectral types A basically don't have coronae, and hotter O and B stars have coronal winds that are heated by completely different mechanisms to the solar corona.