Hubble Space Telescope image of the white dwarf and the far-off background star.

How do you measure the mass of a star?

Well, according to famed cosmologist Albert Einstein, you can try to solve this problem by looking at the subtle bending of starlight as it encounters the immense gravity of another, closer star.

By measuring that light deflection, you could, in theory at least, weigh out the mass of the target star.

There’s only one problem: Einstein never thought that we could actually make this measurement. The legendary scientist said that "there [was] no hope of observing [that distortion] … directly," in a 1936 study published in the journal Science.

But now, about 100 years after Einstein first came up with his theory of general relativity, scientists using the intrepid Hubble Space Telescope have managed to measure a star’s mass using this very method.

A new study, also published in the journal Science, details the new test of Einstein’s landmark theory by measuring the mass of a white dwarf star 17 light-years away from Earth.

Researchers used the Hubble to measure just how much the star — named Stein 2051B — distorted the light of a background star about 5,000 light-years away.

This distortion is called gravitational microlensing, and we know that it’s possible thanks to Einstein’s elegant — and so far very much correct — theory of general relativity.

“This microlensing method is a very independent and direct way to determine the mass of a star,” Kailash Sahu, lead author of the new study, said in a statement. “It’s like placing the star on a scale: The deflection is analogous to the movement of the needle on the scale.”

It works like this: Think about the universe as a massive mattress, and all of the stars, planets, galaxies, black holes and other objects are lying out on that mattress in various sizes and shapes.

Larger objects distort the mattress more than smaller ones. So, in simple terms, a star bends the fabric of space and time more than a planet would because of its greater mass.

Image: NASA, ESA, and A. Feild (STScI)

That gravitational warping in space-time can also bend light, meaning that the light from a distant star, can be bent around a massive object in front of it from Earth’s perspective.

By measuring just how much the light from the background star was distorted by Stein 2051B, the researchers were able to figure out that the white dwarf is about 68 percent the mass of our sun.

But it’s not like the white dwarf’s gravity distorted the light all that much.

"During the close alignment, the white dwarf’s gravity bent the light from the distant star, making it appear offset by about 2 milliarcseconds from its actual position," the Space Telescope Science Institute — the organization that manages the Hubble — said in the statement.

"This deviation is so small that it is equivalent to observing an ant crawl across the surface of a quarter from 1,500 miles away."

This measurement matches predictions used to estimate the white dwarf’s mass.

Scientists have other, less direct means of measuring the masses of white dwarfs.

If the target star is in a close pair with another star, for example, then researchers can use the interaction of those stars to figure out their masses.

The lensing technique, however, will help scientists learn more about their target stars. With future targets, as with Stein 2051B, researchers will be able to peer into the heart of the stars to see exactly what kind of core lies within.

The study’s "measurements show convincingly that Stein 2051 B is not an exotic ‘iron core’ white dwarf but a rather typical one, with a carbon-oxygen core and a normal mass and radius, thus resolving the long-standing debate over its nature," scientist T.D. Oswalt, who was not involved with the new study, said in an analysis piece published with the new work.

Researchers have also used lensing techniques to study far-off objects that have their light warped by larger objects — like huge clusters of galaxies — in the foreground.

Sometimes the light is deformed into a circular artifact in a photo taken of the deep universe.

Appropriately, these kinds of distortions are known as "Einstein rings."