Safeguard
Supply Chain Security•

Laws of Gravity From Newton to Einstein, Explained With Real Numbers

Newton: gravity weakens with distance squared. Einstein: mass curves spacetime. Worked numbers for the Moon, surface gravity and GPS clocks.

Safeguard Security Team
33 min read

Newton's law of universal gravitation says every mass attracts every other mass with a force equal to G times the two masses, divided by the square of the distance between them. Einstein's general relativity, completed in November 1915, replaces that force with curved spacetime, and it predicts effects Newton's law misses, such as GPS satellite clocks running about 38.6 microseconds per day fast.

For most engineering, Newton is accurate enough. Einstein matters where gravity is strong, speeds are high or timing has to be precise to billionths of a second. This guide works through both with real numbers, using the 2022 CODATA constants published by NIST and planetary data from NASA, then covers Kepler's laws, Mercury's orbit, gravitational waves and the questions physics still cannot answer.

Key takeaways

  • Newton's law: F = G * m1 * m2 / r^2. Double the distance and the force drops to a quarter.
  • G is 6.67430 x 10^-11 m^3 kg^-1 s^-2 (CODATA 2022), with a relative uncertainty of 2.2 x 10^-5.
  • The Earth and the Moon pull on each other with about 1.98 x 10^20 newtons.
  • Surface gravity, g = G * M / R^2, is about 9.82 m/s^2 on Earth and 1.62 m/s^2 on the Moon.
  • Kepler's three laws fall out of Newton's law; you can recover the length of a year from them.
  • General relativity explains Mercury's extra 43 arcseconds per century, light bending of 1.75 arcseconds at the Sun's edge, and gravitational waves.
  • GPS satellite clocks are set slow before launch by a fractional 4.4647 x 10^-10, written into the official specification IS-GPS-200.
  • LIGO detected gravitational waves on 14 September 2015, earning the 2017 Nobel Prize in Physics.
  • General relativity and quantum mechanics still do not fit together.

What is Newton's law of universal gravitation?

Isaac Newton set out his theory of gravity in the Principia, first published in 1687. In Andrew Motte's English translation, Book III, Proposition VII states the core idea plainly: "there is a power of gravity tending to all bodies, proportional to the several quantities of matter which they contain." The same book shows that the planets' attraction toward the Sun, and moons' attraction toward their planets, varies "reciprocally as the squares of the distances".

In modern notation:

F = G * m1 * m2 / r^2

F   force between the two bodies, in newtons (N)
G   Newtonian constant of gravitation
m1  mass of the first body, kg
m2  mass of the second body, kg
r   distance between their centres, m

Every mass attracts every other mass. The apple and the Earth pull on each other with the same size of force. Only the apple visibly moves, because the Earth is about 10^24 times more massive.

The force follows an inverse square. At twice the distance, the force is a quarter; at ten times, one hundredth.

r is measured between centres. Newton proved that a spherically symmetric body attracts an outside object as if all its mass sat at its centre, which is why the Earth's radius works as r at its surface.

Newton was careful about what he claimed. In the General Scholium he wrote, in Motte's translation, "I frame no hypotheses" about the cause of gravity. The law said how gravity behaves, not what it is. That question waited more than two centuries for Einstein.

Worked example 1: the force between the Earth and the Moon

Inputs, from NASA's Earth and Moon fact sheets and the CODATA value of G:

QuantityValueSource
G6.67430 x 10^-11 m^3 kg^-1 s^-2NIST, CODATA 2022
Mass of the Earth5.9722 x 10^24 kgNASA Earth fact sheet
Mass of the Moon0.07346 x 10^24 kgNASA Moon fact sheet
Earth to Moon semimajor axis384,400 kmNASA Moon fact sheet
F = G * M_earth * M_moon / r^2
  = 6.67430e-11 * 5.9722e24 * 7.346e22 / (3.844e8)^2
  = 2.928e37 / 1.4776e17
  = 1.98e20 N

That is about 198 billion billion newtons. Because the orbit is an ellipse, the figure changes over the month: about 2.22 x 10^20 N at NASA's mean perigee of 363,300 km and 1.78 x 10^20 N at its mean apogee of 405,500 km. That 25 percent swing is the inverse square law at work. (NASA's Moon fact sheet lists the Earth's mass as 5.9724 x 10^24 kg against 5.9722 on its Earth sheet; the difference changes nothing here.)

Worked example 2: surface gravity on the Earth and the Moon

At the surface of a sphere of mass M and radius R, the force on a mass m is G * M * m / R^2. Divide by m to get the acceleration:

g = G * M / R^2

Earth: g = 6.67430e-11 * 5.9722e24 / (6.371e6)^2 = 9.820 m/s^2
Moon:  g = 6.67430e-11 * 7.346e22  / (1.7374e6)^2 = 1.624 m/s^2

Both match NASA's published surface gravity values: 9.820 m/s^2 as Earth's mean and 1.62 m/s^2 for the Moon. A 70 kg person weighs about 686 N on Earth and about 114 N on the Moon. Their mass stays 70 kg in both places.

NASA also lists 9.780 m/s^2 at the equator and 9.832 m/s^2 at the poles, because the Earth bulges at the equator and spins. The textbook 9.80665 m/s^2 is the standard acceleration of gravity, which CODATA lists as exact because it is a defined conventional value, not a measurement of any place.

What is G and how was it measured?

G sets how strong gravity is for a given amount of mass. It is tiny. Two 1 kg masses whose centres are 10 cm apart attract each other with:

F = 6.67430e-11 * 1 * 1 / (0.1)^2 = 6.67e-9 N

That is a few billionths of a newton, so measuring G means isolating a tiny force from vibration, air currents, temperature drift and the gravity of everything nearby.

Cavendish and the torsion balance

The first laboratory measurement came from Henry Cavendish, who in 1798 reported torsion balance experiments to find the density of the Earth. A light rod carrying small lead balls hung from a thin wire; large lead balls brought close twisted the wire by a measurable angle. Cavendish framed his result as the Earth's mean density, not as a value of G, but the two are linked: once you know how strongly lab masses attract, you can work out the Earth's mass from its surface gravity. Hence the phrase that he "weighed the Earth".

What CODATA says about G today

NIST publishes the CODATA recommended values of the fundamental constants. For G, the 2022 values give:

ConstantValueStandard uncertaintyRelative uncertainty
Newtonian constant of gravitation, G6.67430 x 10^-11 m^3 kg^-1 s^-20.00015 x 10^-112.2 x 10^-5
Speed of light in vacuum, c299,792,458 m/sexactnone
Standard acceleration of gravity, g_n9.80665 m/s^2exactnone

A relative uncertainty of 2.2 x 10^-5 means G is known to about 22 parts per million. That sounds precise until you compare it with c, which has no uncertainty at all because the metre is defined from it.

Why GM is known better than G or M alone

Satellite orbits measure the product G times M directly, so it is known far better than either factor. The GPS specification uses 3.986005 x 10^14 m^3/s^2 for the Earth's gravitational parameter, written mu. Dividing by G gives the Earth's mass, 3.986005e14 / 6.67430e-11 = 5.972e24 kg, but that answer inherits G's uncertainty. Orbit software, including the code inside a GPS receiver, works with GM directly for that reason.

What are Kepler's three laws and how do they follow from Newton?

Johannes Kepler worked out his laws of planetary motion in the early 1600s from Tycho Brahe's observations, especially of Mars. NASA's summary states them like this:

  1. First law. Each planet's orbit about the Sun is an ellipse, with the Sun's centre at one focus.
  2. Second law. The line joining a planet and the Sun sweeps out equal areas in equal times. A planet moves fastest at perihelion, its closest point.
  3. Third law. The square of a planet's orbital period is proportional to the cube of the semimajor axis of its orbit.

Kepler found these patterns in data; Newton showed why. An inverse square force produces ellipses, any central force conserves angular momentum (the second law), and Newton's version of the third law is:

T = 2 * pi * sqrt( a^3 / (G * M) )

T  orbital period, s
a  semimajor axis, m
M  mass of the central body, kg (strictly, the sum of both masses)

Worked example 3: recover the length of a year

NASA gives the Sun's gravitational parameter as 132,712 x 10^6 km^3/s^2, which is 1.32712 x 10^20 m^3/s^2, and the Earth's semimajor axis as 149.598 million km.

T = 2 * pi * sqrt( (1.49598e11)^3 / 1.32712e20 )
  = 3.1558e7 s
  = 365.26 days

NASA's listed sidereal orbit period for the Earth is 365.256 days. One equation, two inputs, and the year falls out.

Worked example 4: Newton's apple and the Moon

If gravity weakens as the inverse square of distance, then at the Moon's distance, about 60 Earth radii, it should be about 1/3,600 of surface gravity: 9.81 * (6.371e6 / 3.844e8)^2 = 0.00269 m/s^2. The acceleration the Moon needs to stay on its path, 4 * pi^2 * r / T^2 with NASA's sidereal month of 27.3217 days, is 0.00272 m/s^2. They agree within about 1 percent: the force that drops an apple holds the Moon in orbit.

What is general relativity, in plain words?

General relativity is Einstein's theory of gravity. Instead of a force acting at a distance, mass and energy curve spacetime, and objects move along the straightest possible paths through that curved spacetime. A planet orbiting the Sun is not being pulled sideways by a string. It is following the natural path in a geometry the Sun has bent.

Einstein presented his final field equations to the Prussian Academy of Sciences in Berlin at its session of 25 November 1915. In that paper he notes that the vacuum field equations on which he had based his explanation of Mercury's perihelion motion, presented a few weeks earlier, were unaffected by the final change. A comprehensive account followed in 1916.

The theory rests on the equivalence principle: a uniform gravitational field and a uniform acceleration cannot be told apart by a local experiment. In a closed lift accelerating at 9.8 m/s^2 in deep space, everything behaves as on Earth. The Gravity Probe B team at Stanford traces the idea to Galileo's observation that, without air resistance, all bodies fall at the same rate.

The theory predicts several effects that Newton's does not, or gets the size wrong:

  • Gravitational time dilation. Clocks deeper in a gravitational field tick more slowly than clocks higher up.
  • Light bending. Light passing a mass is deflected, by twice the amount a simple Newtonian calculation gives.
  • Perihelion precession. Elliptical orbits slowly rotate.
  • Gravitational waves. Accelerating masses send out ripples in spacetime that travel at the speed of light.
  • Black holes. Enough mass in a small enough region traps light.

Newton and Einstein side by side

QuestionNewton (1687)Einstein (1915)
What is gravity?A force between massesCurvature of spacetime caused by mass and energy
How fast does it act?Instantly, at any distanceAt the speed of light
TimeThe same for everyoneRuns at different rates depending on gravity and speed
LightNot covered by the law in its usual formBent by gravity; 1.75 arcseconds at the Sun's edge
Mercury's orbitLeaves about 43 arcseconds per century unexplainedExplains it with no extra assumptions
GPS clock ratesPredicts no correctionPredicts the 38.6 microseconds per day offset
Gravitational wavesDo not existPredicted, detected in 2015
When to use itBridges, rockets, most spacecraft trajectoriesPrecise timing, strong fields, cosmology

A quick test of whether relativity matters is the Schwarzschild radius, r_s = 2 * G * M / c^2, the size inside which a mass would become a black hole. For the Sun it is 2.95 km against a real radius of about 696,000 km, a ratio of about four parts in a million. That is why Newton works so well in the solar system, and why relativistic effects there are small but measurable.

Why was Mercury's perihelion the first big test?

Mercury's orbit is the most elliptical of the planets, with an eccentricity of 0.2056 in NASA's fact sheet. The point of closest approach, the perihelion, slowly swings around the Sun. Most of that swing comes from the pull of the other planets and is fully explained by Newton.

According to the Gravity Probe B team, astronomers had known since Urbain Le Verrier's work in 1859 that Mercury's perihelion was advancing too quickly to be explained by known factors. Proposed fixes, such as an unseen planet named Vulcan inside Mercury's orbit, all failed. The Stanford team writes that when Einstein found his theory explained the anomaly with no special assumptions, he was "for several days beside myself with joyous excitement".

Worked example 5: compute the extra precession yourself

General relativity predicts an extra advance per orbit of:

delta_phi = 6 * pi * G * M_sun / ( c^2 * a * (1 - e^2) )

With the Sun's GM of 1.32712 x 10^20 m^3/s^2, Mercury's semimajor axis of 57.909 million km and eccentricity of 0.2056 (both from NASA's Mercury fact sheet):

delta_phi = 6 * pi * 1.32712e20 / ( (299792458)^2 * 5.7909e10 * (1 - 0.2056^2) )
          = 5.02e-7 radians per orbit
          = 0.1035 arcseconds per orbit

orbits per century = 36525 days / 87.969 days = 415.2
total              = 0.1035 * 415.2 = 43.0 arcseconds per century

An arcsecond is 1/3,600 of a degree, so 43 arcseconds per century is tiny. It was still well beyond the measurement error of the time, and Newton's law had no way to produce it.

The Stanford team notes that modern radar based measurements now constrain any departure from general relativity in this test to less than 0.3 percent.

How was general relativity tested after 1915?

The Mercury result was a retrodiction: it explained something already known. The theory then had to predict new things and survive.

Light bending and the 1919 eclipse

Light grazing the Sun should bend by:

deflection = 4 * G * M_sun / ( c^2 * R_sun )
           = 4 * 1.32712e20 / ( (299792458)^2 * 6.957e8 )
           = 8.49e-6 radians
           = 1.75 arcseconds

A Newtonian argument treating light as falling particles gives half that; according to the Gravity Probe B team, Johann Georg von Soldner made such a calculation in 1803. Expeditions led by Arthur Eddington and Andrew Crommelin photographed the eclipse of May 1919, and the Stanford account says the results supported Einstein "with an accuracy of only about 30%". Radio measurements of distant quasars had confirmed the prediction to 0.04 percent by 1995.

Gravitational redshift in a tower

R. V. Pound, G. A. Rebka and J. L. Snider measured the frequency shift between gamma ray sources moving up and down Harvard's Jefferson tower in the 1960s, to about 1 percent. Near the surface the fractional shift is about g * h / c^2, or 9.81 / (299792458)^2 = 1.09e-16 per metre of height.

Gravity Probe B

Gravity Probe B used four gyroscopes in orbit to measure the geodetic effect and frame dragging. Stanford's status page of 4 May 2011 reports 6,601.8 plus or minus 18.3 and 37.2 plus or minus 7.2 milliarcseconds per year, against predictions of 6,606.1 and 39.2. The paper appeared in Physical Review Letters on 31 May 2011.

The binary pulsar

In 1974 Russell Hulse and Joseph Taylor found a pulsar orbiting another compact star, using the 300 m Arecibo radio telescope. The orbit shrank exactly as general relativity predicts for energy lost to gravitational waves, the first evidence they exist. Hulse and Taylor received the 1993 Nobel Prize in Physics.

A dated timeline of gravity

YearEventSource
Early 1600sKepler derives his laws of planetary motion from Tycho Brahe's dataNASA
1687Newton publishes the Principia with the law of universal gravitationPrincipia (Motte translation)
1798Cavendish reports his torsion balance measurement of the Earth's densityPhilosophical Transactions (not fetched)
1859Le Verrier identifies Mercury's anomalous perihelion advanceGravity Probe B, Stanford
25 Nov 1915Einstein presents the final field equations in BerlinSitzungsberichte, via Wikisource
May 1919Eclipse expeditions led by Eddington and Crommelin measure light bendingGravity Probe B, Stanford
1974Hulse and Taylor discover the binary pulsarNobel Prize 1993 press release
23 Jun 1977NTS-2 launches the first caesium atomic clock into orbitAshby, Living Reviews in Relativity
4 May 2011Gravity Probe B final results announcedGravity Probe B, Stanford
14 Sep 2015LIGO detects gravitational waves from merging black holesLIGO Caltech
3 Oct 2017Nobel Prize in Physics awarded for LIGONobelPrize.org

How does GPS correct for relativity?

GPS is the most widely used everyday proof of general relativity. Receivers time signals from several satellites, and light travels about 30 cm in a nanosecond, so nanosecond clock errors become metres of position error.

According to GPS.gov, the satellites fly at about 20,200 km altitude and circle the Earth twice a day, and receivers can determine time to within 100 billionths of a second.

Two effects pull a satellite clock in opposite directions:

  1. Gravitational blueshift. Higher in the Earth's field, the satellite clock runs faster.
  2. Velocity time dilation. Moving at nearly 3.9 km/s, it runs slower.

Worked example 6: GPS clock drift from first principles

Use the GPS value of the Earth's gravitational parameter, mu = 3.986005 x 10^14 m^3/s^2, a ground radius of 6,371 km and an orbit radius of about 26,560 km (20,200 km altitude plus the Earth's radius).

Orbital speed:  v = sqrt(mu / a) = sqrt(3.986005e14 / 2.656e7) = 3,874 m/s

Gravity term:   (mu / c^2) * (1/R_earth - 1/a)
              = (3.986005e14 / 8.98755e16) * (1/6.371e6 - 1/2.656e7)
              = +5.29e-10   (satellite clock runs fast)

Speed term:     -v^2 / (2 * c^2)
              = -(3874)^2 / (2 * 8.98755e16)
              = -0.83e-10   (satellite clock runs slow)

Net:            +5.29e-10 - 0.83e-10 = +4.46e-10

Per day:        4.46e-10 * 86,400 s = 38.5 microseconds fast

Gravity wins by a wide margin. This back of the envelope result ignores the Earth's rotation and the exact shape of the geoid, which Neil Ashby's review in Living Reviews in Relativity handles in full. Even so, it lands within a fraction of a percent of the official figure.

What the official GPS specification says

The interface specification IS-GPS-200, published on GPS.gov, states that satellite clock rates are offset by a fractional -4.4647E-10 to compensate for relativistic effects. Applied to the 10.23 MHz reference, that gives a satellite oscillator of 10.2299999954326 MHz. On the ground, the clock then appears to run at exactly 10.23 MHz.

4.4647e-10 * 86,400 s/day = 38.6 microseconds per day
38.6e-6 s * 299,792,458 m/s = 11.6 km of light travel

The second line is the famous "GPS would drift about 11 km a day" figure. Treat it as a scale, not a literal map error: receivers solve for their own clock bias, so a common offset would not map one to one into position. Without the correction the system would still fail within hours.

Orbits are slightly elliptical, so a periodic term remains. IS-GPS-200 has receivers correct it with a constant F of -4.442807633 x 10^-10 seconds per square root metre, multiplied by the eccentricity, the square root of the semimajor axis and the sine of the eccentric anomaly.

The NTS-2 test in 1977

Ashby recounts that NTS-2, launched on 23 June 1977 with the first caesium clock in orbit, carried a frequency synthesizer because some doubted the correction was needed. Uncorrected for about 20 days, the clock ran +442.5 parts in 10^12 against ground clocks; general relativity predicted +446.5. That was about a 1 percent confirmation. Ashby also notes that a top caesium clock left alone for a day stays within about 4 nanoseconds, while the relativistic offsets are thousands of times larger.

For the wider dependency of networks, power grids and finance on GPS time, see GPS timing: the hidden dependency in your stack.

What are gravitational waves and how did LIGO detect them?

Gravitational waves are ripples in spacetime that move outward at the speed of light whenever masses accelerate. The Nobel Committee's press release compares the source to an ice skater pirouetting or a pair of black holes circling each other. Einstein predicted them, and, according to the same release, he was convinced it would never be possible to measure them.

LIGO, the Laser Interferometer Gravitational-wave Observatory, uses two large L shaped laser interferometers, one in Livingston, Louisiana and one in Hanford, Washington. A passing wave stretches one arm and squeezes the other by a minuscule amount. The Nobel release describes the change LIGO measures as "thousands of times smaller than an atomic nucleus".

The first detection: GW150914

LIGO's announcement says the waves were detected on 14 September 2015 at 09:51 UTC by both detectors. According to LIGO:

  • The source was two black holes of about 29 and 36 solar masses merging 1.3 billion years ago.
  • About 3 solar masses were converted into gravitational waves in a fraction of a second.
  • The Livingston detector recorded the event 7 milliseconds before Hanford, which placed the source in the southern sky.
  • In the final fraction of a second the black holes collided at nearly half the speed of light.

Worked example 7: how much energy is three suns?

With NASA's solar mass of 1.9884 x 10^30 kg, E = 3 * 1.9884e30 * (299792458)^2 = 5.4e47 joules. At NASA's solar luminosity of 3.828 x 10^26 watts, the Sun would need about 45 trillion years to emit that much. The merger did it in a fraction of a second.

The 2017 Nobel Prize

On 3 October 2017 the Royal Swedish Academy of Sciences awarded the Nobel Prize in Physics with one half to Rainer Weiss and the other half jointly to Barry C. Barish and Kip S. Thorne "for decisive contributions to the LIGO detector and the observation of gravitational waves". The release credits Weiss with designing a laser interferometer detector in the mid 1970s and Barish with bringing the project to completion.

Where does Newton's law break down?

Newton's law remains the working tool for bridges and most spacecraft trajectories. It needs correction for precise timing (GPS clocks), strong gravity (black holes, neutron star binaries), light (deflection half the measured value) and changing fields (it acts instantly and has no waves). Ashby gives a neat crossover: for a clock in a circular orbit, the speed and gravity effects cancel at a radius of about 9,545 km. Below that, as in low Earth orbit, the clock runs slow; above it, as for GPS, it runs fast.

What open questions about gravity remain?

General relativity has passed every experimental test so far. The Gravity Probe B team still lists reasons to expect it is incomplete:

  • Singularities. The theory predicts points of infinite curvature, at the Big Bang and inside black holes, where its own equations stop working.
  • Dark matter and dark energy. Cosmology only matches observations if ordinary matter is supplemented by much larger amounts of unseen dark matter and dark energy that fit nothing in the standard model of particle physics. Some physicists read that as a breakdown of general relativity at large scales.
  • Strong fields. Most tests probe weak fields, where Einstein's theory reduces to Newton's.
  • Quantum gravity. No tested theory joins general relativity with quantum mechanics.

A more practical gap: G itself is known to only about 22 parts per million.

Safeguard's models are security models and do not do physics. These questions are being worked on with telescopes, detectors and theory.

Step by step: reproduce these numbers and keep the code honest

Physics results increasingly come from code, and the same habits that keep application code trustworthy keep scientific code trustworthy. This walkthrough reproduces the key results above and then locks down the environment.

1. Compute the worked examples, with sourced constants

# gravity_examples.py
# CODATA 2022 values from NIST; planetary data from NASA fact sheets.
import struct

G = 6.67430e-11            # m^3 kg^-1 s^-2, standard uncertainty 0.00015e-11
C = 299_792_458.0          # m/s, exact
M_EARTH, M_MOON = 5.9722e24, 0.07346e24   # kg
R_EARTH, R_MOON = 6.371e6, 1.7374e6       # m
D_EARTH_MOON = 384_400e3   # m, semimajor axis
GPS_OFFSET = -4.4647e-10   # fractional clock offset, IS-GPS-200

def as_float32(x):
    return struct.unpack("f", struct.pack("f", x))[0]

force = G * M_EARTH * M_MOON / D_EARTH_MOON**2
g_earth = G * M_EARTH / R_EARTH**2
g_moon = G * M_MOON / R_MOON**2
print(f"Earth-Moon force: {force:.3e} N")
print(f"Surface gravity Earth: {g_earth:.3f} m/s^2, Moon: {g_moon:.3f} m/s^2")

print(f"Clock offset per day: {abs(GPS_OFFSET) * 86400 * 1e6:.1f} microseconds")
print(f"Light travel in that time: {abs(GPS_OFFSET) * 86400 * C / 1000:.1f} km")

print("float64 keeps the offset:", (1.0 + GPS_OFFSET) != 1.0)
print("float32 keeps the offset:", as_float32(1.0 + GPS_OFFSET) != 1.0)

Running it prints:

Earth-Moon force: 1.982e+20 N
Surface gravity Earth: 9.820 m/s^2, Moon: 1.624 m/s^2
Clock offset per day: 38.6 microseconds
Light travel in that time: 11.6 km
float64 keeps the offset: True
float32 keeps the offset: False

The last two lines are the software lesson. A single precision float carries about seven significant digits, so adding 4.4647 x 10^-10 to 1.0 in float32 rounds straight back to 1.0, with no error. Double precision keeps it. Timing code that stores rates in the wrong type can silently discard the very physics it was written to apply. If you take constants from a library instead, print them (python3 -c "import scipy.constants as k; print(k.G)") and check which CODATA edition it implements.

2. Pin the environment

python3 -m venv .venv
. .venv/bin/activate
pip install numpy scipy
pip freeze > requirements.txt

For builds you want to reproduce exactly, record hashes and install with pip install --require-hashes -r requirements.txt, so a changed artifact fails loudly instead of slipping in. Our guide to reproducible builds explains why identical inputs matter.

3. Scan what the code depends on

Numerical libraries are large open source projects with their own dependency trees and their own advisories. The NumPy security guide covers the risks specific to that library. To see what your project pulls in and which components have known vulnerabilities:

safeguard scan --dir .

Results are written as JSON under ./output. In a container based pipeline, safeguard scan --image <name> does the same for the image that will run the simulation.

Where Safeguard fits, honestly

Safeguard does not do physics, check your equations or catch a constant from the wrong CODATA edition. The overlap is the software around the science: orbit propagators, timing daemons and research notebooks all ship open source components. Safeguard scans repositories, container images and SBOM files, matches components against vulnerability databases, uses reachability analysis to rank the vulnerable code paths your code actually calls, and shows which projects carry a given component and version. That is useful when a numerical library or a time synchronisation package gets an advisory and you need to know where it runs.

Common mistakes

These are the misconceptions that come up most often about gravity, with the correction for each.

  • "There is no gravity in space." At 400 km altitude, 3.986e14 / (6.771e6)^2 gives 8.69 m/s^2, about 89 percent of surface gravity. Astronauts float because they and their spacecraft are in free fall together.
  • "Heavier objects fall faster." Without air resistance all bodies fall at the same rate, the idea the equivalence principle builds on.
  • "Einstein proved Newton wrong." General relativity reduces to Newton's law when gravity is weak and speeds are low, which is why engineers still use Newton daily.
  • "g is 9.8 everywhere." It ranges from 9.780 m/s^2 at the equator to 9.832 m/s^2 at the poles; 9.80665 is a defined standard.
  • "Cavendish measured G." He reported the density of the Earth. G can be derived from his result, but that is not how he framed it.
  • "GPS clocks run slow because the satellites move fast." Speed slows them by about 7 microseconds per day; weaker gravity speeds them up by about 46. The net is fast.
  • "Mass and weight are the same thing." Mass is kilograms of matter; weight is the force on it, in newtons. A 70 kg person weighs about 686 N on Earth and 114 N on the Moon.

FAQ

What is the formula for Newton's law of gravity?

F = G * m1 * m2 / r^2, where G is 6.67430 x 10^-11 m^3 kg^-1 s^-2 (CODATA 2022), m1 and m2 are the masses in kilograms, and r is the distance between their centres in metres.

What is the value of the gravitational constant G?

NIST's 2022 CODATA recommended value is 6.67430 x 10^-11 m^3 kg^-1 s^-2, with a standard uncertainty of 0.00015 x 10^-11, a relative uncertainty of 2.2 x 10^-5.

What is the difference between Newton's and Einstein's theories of gravity?

Newton treats gravity as an instant force between masses. Einstein treats it as curved spacetime, with changes spreading at light speed. Einstein's theory also predicts time dilation, light bending and gravitational waves.

Why do GPS satellites need relativity corrections?

Their clocks run about 38.6 microseconds per day fast relative to ground clocks, mostly because gravity is weaker at 20,200 km. IS-GPS-200 sets their frequency slightly low before launch to compensate.

How much does gravity affect time?

Near Earth's surface, a clock one metre higher runs faster by about 1.1 x 10^-16. At GPS altitude, the gravitational part alone is about 5.3 x 10^-10, or 46 microseconds per day.

Who discovered gravitational waves?

Einstein predicted them. LIGO first detected them directly on 14 September 2015. Rainer Weiss, Barry Barish and Kip Thorne shared the 2017 Nobel Prize in Physics for that work.

What is the force of gravity between the Earth and the Moon?

About 1.98 x 10^20 newtons at the average distance of 384,400 km. It rises to about 2.2 x 10^20 N near perigee and falls to about 1.8 x 10^20 N near apogee.

Why is gravity on the Moon one sixth of Earth's?

The Moon has about 1.2 percent of Earth's mass and 27 percent of its radius. Using g = G * M / R^2, that gives 1.62 m/s^2 against 9.82 m/s^2, a ratio of about 0.165.

What problems about gravity are still unsolved?

How to combine general relativity with quantum mechanics, what dark matter and dark energy are, and what happens at singularities inside black holes and at the Big Bang. G itself is also known only to about 22 parts per million.

Fix it without waiting for upstream

Gravity itself has no dependencies, but the code that computes orbits, keeps time and processes detector data does: numerical libraries, time synchronisation packages and the containers they run in all ship open source components. The fit here is indirect, so treat what follows as how the same patch discipline applies to that scientific and timing software, not to the physics.

Whatever the vulnerability, most of the risk sits in two gaps. The first is the time between a fix being published and that fix actually running in your production builds. The second, and worse, is the time before any fix exists at all, while a maintainer works out a patch and a release schedule. Waiting through both gaps is a habit, not a requirement. Safeguard gives teams three ways to close them.

1. Autonomous remediation: pull requests, not tickets

When a fixed version exists, Safeguard's Griffin models open a tested, policy gated pull request that moves the affected dependency to the safe version. You can run it on one repository or in bulk across every project that carries the vulnerable version. Remediation covers eight categories, including dependencies, licenses, security posture and findings. Reachability analysis ranks the vulnerable code paths your application actually calls first, so the first pull requests you merge are the ones that matter most. Autonomous remediation ships switched off, with every category set to Manual, so your team decides how much runs on its own and what still needs a human approval.

2. Gold Open Source: the safe version in seconds, free

gold.safeguard.sh is free and needs no login. Search any CVE or package to see affected and fixed versions, CVSS, EPSS, CISA KEV status and a recommended safe version, or use the "Am I affected?" checker. The same data is available through a free read API, README status badges and RSS threat feeds. The safeguard-sh/gold-scan-action GitHub Action can fail a build on a known exploited vulnerability, on any known vulnerability, or never, so a version you have just removed cannot quietly come back in next week's merge.

3. Gold Registry: start from components that are already fixed

registry.safeguard.sh provides hardened, drop in replacements for upstream packages and container images. Every Gold artifact is held continuously to zero exploitable critical or high CVEs, zero malware and a completed license check, with SLSA L3 or higher provenance, a Sigstore signature and a public evidence page you can hand to an auditor. An artifact loses its Gold badge if it regresses. Teams can point their own package directory at the registry so hardened equivalents resolve without changing how developers install anything.

When upstream has no fix yet, or will not ship one, Safeguard first works to get the fix accepted upstream. If the issue is severe or upstream will not move, Safeguard builds a fork, fixes the vulnerability there and publishes a hardened Gold build, so you are not stuck on a maintainer's release schedule. You can also request a hardened, compatibility tested build of a specific package. This fork and patch flow is in early access today, so ask which packages it covers before you plan around it.

Your situationWhat to use
A fixed version existsAutonomous remediation opens the upgrade pull request; Gold Open Source confirms the safe version
You need to know today whether you are affectedGold Open Source lookup and "Am I affected?" checker, free and without login
You want vulnerable versions to stop shippingThe Gold scan GitHub Action in CI, plus Safeguard policies and gates
Upstream has no fix yet, or will not ship oneA custom Gold request; fork and patch (early access)
You want to start clean on new projectsPull hardened components and images from Gold Registry

One honest limit: when the vulnerable code lives in a vendor appliance, a hosted service or an operating system runtime you do not build yourself, the fix still has to come from that vendor or distribution. The steps above apply to the open source dependencies and container images you build and ship, which is where most teams carry the largest and least tracked share of their exposure.

To try it on your own machine, download Safeguard from https://safeguard.sh/download and see the CLI documentation at https://docs.safeguard.sh/docs/cli .

See how Safeguard would help

The first demo is a real Safeguard CLI session. Asked to fix a lodash CVE, it reads the finding and advisory, asks before each command, edits package.json to lodash 4.17.21, runs npm install and npm test with approval, and pushes nothing. The same approve each step flow applies when a numerical or timing library in a Python project needs an upgrade; the CLI handles the dependency, not the physics.

Click through it at your own pace, or open it full screen.

The second demo sets up Safeguard's local runner on your own machine, approves it with a device code, and runs a scan from the terminal. For a research workstation or a lab build host, that is how you would see which packages a simulation environment actually pulled in.

Click through it at your own pace, or open it full screen.

Quick check

Do GPS satellite clocks run fast or slow compared with clocks on the ground, and by how much?

Fast, by about 38.6 microseconds per day. Weaker gravity at altitude speeds them up by about 46 microseconds per day, and their orbital speed slows them by about 7. IS-GPS-200 sets their frequency low by a fractional 4.4647 x 10^-10 to compensate.

How many arcseconds per century of Mercury's perihelion advance does general relativity explain?

About 43. Using the Sun's GM and Mercury's orbit from NASA, the formula 6 * pi * G * M / (c^2 * a * (1 - e^2)) gives 0.1035 arcseconds per orbit, and Mercury completes about 415 orbits per century.

Sources

Last reviewed: 23 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.