Work Calculator (Variable Force)

  • Free
  • No sign-up
  • Works on phones
  • Shows the working
Physics & Applied#26

Work Done by a Variable Force

\(W = \int_a^b F(x)\,dx\) (newtons × metres = joules).

This work calculator finds the work done by a force that changes with position. First, enter the force \( F(x) \) in newtons and the start and end positions in meters, and it evaluates \( W = \int_a^b F(x)\,dx \), giving the answer in joules.

It’s the tool for the “work” section of Calculus II and intro physics: stretching and compressing springs with Hooke’s law, winding up chains and cables, or any force given as a formula. Also, it’s free and needs no sign-up.

Work Calculator (Variable Force): The work to stretch a spring with F(x) = 4x newtons from 0 to 2 metres is the area under…
The work to stretch a spring with F(x) = 4x newtons from 0 to 2 metres is the area under the force graph: 8 joules.

How to use the work calculator

  1. Type the force as a function of position in F(x). Use ^ for powers (5x^2), plus sqrt(), sin(), ln(), e^(x) and pi as needed. Implicit multiplication works, so 250x and 5(10 - x) are fine.
  2. Enter the starting position in From a and the ending position in To b, both in meters. Fractions and constants such as 1/2 are accepted.
  3. Press Compute work. As a result, the result is \( W \) in joules, found by numerical integration.

The calculator assumes newtons and meters. If your problem uses centimeters, convert first (12 cm is 0.12 m), or the answer won’t be in joules.

A person working on a laptop and taking notes, with a diagram nearby.

The work formula

For a constant force F acting along a straight-line displacement d, work is

A person's hand holding a pencil, with a notebook, glasses, and plant.

$$W = Fd\cos\theta$$

Here \( \theta \) is the angle between force and motion. This makes \( W = Fd \) when they point the same way. Work is measured in joules: \( 1 \text{ J} = 1 \text{ N}\cdot\text{m} \). Pushing a box 4 m with 50 N does \( 200 \) J of work. A work calculator shows pulling it with the same force at \( 60^\circ \) to the floor does \( 50 \cdot 4 \cdot \cos 60^\circ = 100 \) J.

When force changes with position, like a spring or a winding cable, split the motion into small pieces. Add these pieces up. This turns the formula into an integral. Our work calculator evaluates this integral.

Formula

For a constant force, work is force times distance. When the force varies, split the path into small pieces of width \( \Delta x \). Treat the force as constant on each piece, and add up \( F(x_i)\,\Delta x \). That’s a Riemann sum. Its limit is the integral, useful in a work calculator.

$$W = \int_a^b F(x)\,dx$$

For springs, Hooke’s law says the force needed to hold a spring \( x \) meters beyond its natural length is

$$F(x) = kx$$

where \( k \) is the spring constant in N/m. So, integrating gives the spring work formula:

$$W = \int_a^b kx\,dx = \tfrac{k}{2}\left(b^2 - a^2\right)$$

Worked example: a spring

A force of 30 N holds a spring stretched 0.12 m beyond its natural length. How much work does it take to stretch it from 0.1 m to 0.3 m beyond natural length?

Find \( k \). From \( 30 = k(0.12) \), \( k = 250 \) N/m, so \( F(x) = 250x \).

Integrate. An antiderivative of \( 250x \) is \( 125x^2 \) (by the power rule in reverse), so by the Fundamental Theorem of Calculus:

$$W = 125(0.3)^2 - 125(0.1)^2 = 10\ \text{J}$$

That’s the calculator’s prefilled input above. Notice that stretching the same spring from 0 to 0.1 m takes only 1.25 J: the farther it’s stretched, the harder each extra centimeter becomes.

Worked example: lifting a chain

A 10 m chain weighing 5 N/m hangs from the top of a building. How much work does it take to pull the whole chain up?

Heavy-duty chains and hooks used for lifting, with some wear and tear.

After \( x \) meters have been pulled up, \( 10 - x \) meters are still hanging, so the force needed is \( F(x) = 5(10 - x) \) N. Integrate from 0 to 10:

$$W = \int_0^{10} 5(10 - x)\,dx = \Big[50x - 2.5x^2\Big]_0^{10} = 250\ \text{J}$$

Enter 5(10 - x) with limits 0 and 10 to check. The answer also makes sense physically: the chain’s total weight is 50 N and its center of mass rises 5 m.

Setting up F(x): common mistakes

  • Measuring from the wrong zero. In Hooke’s law, \( x \) is the stretch beyond natural length, not the spring’s total length. For example, if a spring’s natural length is 20 cm and it’s stretched to 30 cm, that’s \( x = 0.1 \) m.
  • Mixing units. Stretching from 10 to 30 in centimeters with \( k = 250 \) N/m gives 100,000, which is meaningless. Convert to meters first.
  • Swapping the limits. Integrating from the end to the start flips the sign of \( W \).
  • Pumping-tank problems. For pumping liquid out of a tank, the work formula is an integral of weight per slice times lift distance. Once you’ve written that integrand as a function of one variable, you can enter it here as \( F(x) \).

Worked example: pumping water out of a tank

A cylindrical tank of radius 1 m and height 2 m is full of water (density 1,000 kg/m³). How much work does it take to pump all the water out over the top?

A thin layer at height \( y \) has volume \( \pi(1)^2\,dy \), weight \( 1000 \times 9.81 \times \pi\,dy \) newtons, and must be lifted \( 2 - y \) metres:

$$W = \int_0^2 9810\pi(2 - y)\,dy = 9810\pi\left[2y - \frac{y^2}{2}\right]_0^2 = 19{,}620\pi \approx 61{,}640 \text{ J}$$

Constant force vs variable force

With a constant force, work is simply force × distance: lifting a 10 kg box 2 m takes \( 10 \times 9.81 \times 2 = 196.2 \) J. The integral is needed when the force changes along the way, as with springs, chains being wound up, or water lifted from different depths.

Units

Force in newtons and distance in metres give work in joules (1 J = 1 N·m). In US units, however, pounds and feet give foot-pounds.

Practice problems

  1. A spring with \( k = 50 \) N/m is stretched from 0 to 0.2 m. So, find the work.
  2. A force \( F(x) = 3x^2 \) N moves an object from \( x = 0 \) to 2 m. So, find the work.

Answers: 1. \( \int_0^{0.2} 50x\,dx = 1 \) J. 2. \( \int_0^2 3x^2\,dx = 8 \) J.

Related guides

Further reading

FAQ

How do you calculate work done by a spring?

Find \( k \) from the given force and stretch using \( F = kx \), then integrate \( kx \) between the two stretch distances. The result is \( \frac{k}{2}(b^2 - a^2) \) joules.

Why is work an integral?

Work is force times distance only when force is constant. For a work calculator, when force changes along the path, you add up force times tiny distances. That sum becomes the integral \( \int_a^b F(x)\,dx \).

What units does the work calculator use?

It assumes \( F \) in newtons and \( x \) in meters, so \( W \) comes out in joules (newton-meters). With pounds and feet, the same number is in foot-pounds.

Does it show the antiderivative?

No. Instead, it evaluates the integral numerically and shows the value of \( W \). The worked examples above show how to get the same number by hand, and the integral calculator shows the antiderivative with steps.

Embed this calculator on your website

Teachers, tutors and bloggers are welcome to use this calculator for free. Copy the code below and paste it into any page (in WordPress, use a "Custom HTML" block). The small script makes the calculator grow to fit its answer; if your site removes scripts, it still works at a fixed height. Please keep the credit link.

More calculators

See all calculators