Line Integral vs Surface Integral: How to Set Up Each One

Line integral vs surface integral - a vector field flowing along a parametrised curve beside a curved surface covered in outward normal vectors showing flux
Marko Šinko
11 min read
Vector CalculusLine IntegralsSurface IntegralsMultivariable Calculus

Line integral vs surface integral comes down to one question: how many parameters does the thing you are integrating over need? A curve needs one, so you get ds and a single integral sign. A surface needs two, so you get dS and a double integral. Everything else — the cross products, the orientation headaches, the four named theorems — follows from that count.

Students rarely get stuck on the integration itself. They get stuck on the setup: which differential to write, where the square root came from, whether the normal points up or down. So this guide is built around the setup. Two worked examples on the same curve, two on the same cylinder, a table of dS for the surfaces that actually appear on exams, and a ten-second rule for picking between Green’s, Stokes’ and the divergence theorem.

Line Integral vs Surface Integral: One Wire, One Sheet

There are four integrals hiding under two names, because both the line integral and the surface integral come in a scalar flavour and a vector flavour. Mixing them up is the single most common reason a correct calculation gets zero marks.

IntegralWritten asAnswer isPhysical reading
Scalar lineC f dsA number, no sign issueMass of a wire with density f
Vector lineC F·drA number, sign flips with directionWork done moving along C
Scalar surface∫∫S f dSA number, no sign issueMass of a shell with density f
Vector surface (flux)∫∫S F·n dSA number, sign flips with orientationNet flow through S per unit time

The pattern is worth stating plainly. The scalar versions ask “how much stuff is spread over this object?” and cannot come out negative if f is positive. The vector versions ask “how much of this field points the way I chose?” — which means you have to choose, and the choice is half the problem. Reverse the direction you walk the curve and the work changes sign. Flip the normal on the surface and the flux changes sign. Nothing about the field changed; only your convention did.

A useful sanity check before any of this: is the field even worth integrating along a path? Run it through the curl calculator first. If ∇×F = 0 on a simply connected region, the line integral is path-independent and you can skip the parametrisation entirely — find a potential function and subtract endpoint values.

The Setup, Side by Side

One parameter, one derivative, one magnitude

Parametrise the curve as r(t) = (x(t), y(t), z(t)) for t in [a, b]. Then ds = |r′(t)| dt and dr = r′(t) dt. That single magnitude bar is the whole difference between the two line integrals, and forgetting it is mistake number one.

Same curve, two answers

C is the quarter circle r(t) = (3cos t, 3sin t), t from 0 to π/2. So r′(t) = (−3sin t, 3cos t) and |r′(t)| = 3.

Scalar, with f = x + y:0π/2 (3cos t + 3sin t)(3) dt = 9[sin t − cos t]0π/2 = 9(1 − (−1)) = 18

Vector, with F = (−y, x): F(r(t))·r′(t) = 9sin²t + 9cos²t = 9, so the integral is 9 · (π/2) = 9π/2 ≈ 14.14

Two different numbers from one curve. The first is a mass; the second is work. If you had walked the quarter circle clockwise instead, the 18 would still be 18 and the 14.14 would become −14.14. Both setups are handled by the line integral calculator, but do the parametrisation by hand once — the |r′(t)| step is the part that transfers to surfaces.

Two parameters, one cross product

Now the surface. Parametrise it as r(u, v), take both partial derivatives, and cross them. The vector ru × rv does double duty: its magnitude gives the area element and its direction gives the normal.

dS = |ru × rv| du dv   and   n dS = ±(ru × rv) du dv

Compare that to the curve, where |r′(t)| dt gave arc length and r′(t) dt gave the tangent direction. Identical logic, one dimension up. The cross product replaces the ordinary derivative because two tangent vectors need combining instead of one.

The cylinder, worked

S is the side of x² + y² = 9 between z = 0 and z = 5. Take r(θ, z) = (3cos θ, 3sin θ, z).

rθ = (−3sin θ, 3cos θ, 0),   rz = (0, 0, 1)

rθ × rz = (3cos θ, 3sin θ, 0), magnitude 3, so dS = 3 dθ dz

Surface area = ∫050 3 dθ dz = 30π, which matches 2πrh = 2π(3)(5). The parametrisation is doing its job.

That check matters more than it looks. Before integrating anything interesting over a surface, integrate 1 and confirm you get the area you expect. If the area is wrong the flux will be wrong, and an area is far easier to verify against a formula you already trust.

Flux Is Where the Marks Actually Go

Flux asks how much of a vector field passes through a surface, and the answer is a signed number. Keep the cylinder from above and push the field F = (x, y, 0) through it. The outward unit normal on the curved side is n = (cos θ, sin θ, 0), and on the surface F = (3cos θ, 3sin θ, 0), so

F·n = 3cos²θ + 3sin²θ = 3,   flux = 3 × 30π = 90π ≈ 282.7

The integrand collapsed to a constant, which happens whenever the field is radial and the surface is a level set of that radius. Now verify it a completely different way. Close the cylinder with its two flat caps, where n = (0, 0, ±1) and F·n = 0, so the caps contribute nothing. The divergence theorem then says the total outward flux equals ∭ ∇·F dV. Here ∇·F = 2, and the solid cylinder has volume π(3²)(5) = 45π, giving 2 × 45π = 90π. Two independent routes, one answer.

That is the habit worth building: whenever a surface can be closed cheaply, compute the flux both ways. It catches orientation errors instantly, because a flipped normal gives you −90π and the mismatch is impossible to miss. The divergence calculator handles the ∇·F step and the flux calculator the surface side.

Which way is “outward”, concretely

For a closed surface, outward means away from the enclosed solid — no ambiguity once you can picture the region. For an open surface, there is no interior, so the problem must tell you: upward, away from the origin, or induced by the boundary orientation. Get it from the wording, not from instinct.

One concrete rule that saves time on graph surfaces: if S is z = f(x, y) and you take r(x, y) = (x, y, f), then rx × ry = (−fx, −fy, 1). That third component is +1, so this cross product always points upward. Want the downward normal? Negate the whole vector. You never have to reason about it geometrically again.

Green’s, Stokes’, Divergence: Choosing in Ten Seconds

Every one of these theorems trades an integral over a boundary for an integral over the thing the boundary encloses. Count dimensions and the choice makes itself, because each theorem raises the dimension by exactly one and pays for it with a derivative.

TheoremTradesCosts youReach for it when
FTC for line integralsCurve → two endpointsFinding a potential f∇×F = 0 and the region has no holes
Green’sClosed plane curve → flat regionOne partial-derivative differenceEverything lives in the xy-plane
Stokes’Closed space curve → any surface it boundsComputing ∇×FThe curve is ugly but bounds something simple
Divergence (Gauss)Closed surface → enclosed solidComputing ∇·FS is closed, or can be closed with easy caps

Here is the part most courses never say out loud: Green’s theorem is not a separate result. Take Stokes’ theorem, flatten the surface into the xy-plane so n = (0, 0, 1), and only the k-component of the curl survives — that component is ∂Q/∂x − ∂P/∂y, which is exactly Green’s theorem. Write Green’s in its flux form instead and you get the two-dimensional divergence theorem. Three theorems, one idea, and knowing that means you only really have to remember one of them. Wikipedia’s article on the generalized Stokes theorem states the version that contains all of them.

The practical payoff of Stokes’ theorem is that the surface is yours to choose. Any surface with the given boundary works, so a circulation around a jagged space curve becomes a flux through whatever flat disc or paraboloid cap is easiest to parametrise. Set it up with the Stokes theorem calculator, or stay in two dimensions with the Green’s theorem calculator.

Five Setup Errors and What Each One Costs

None of these are arithmetic slips. Each one produces a clean, confident, wrong answer.

  1. Writing dA where dS belongs. Integrating over the shadow instead of the surface. For the plane z = 6 − 2x − 3y the correct element is √(1 + 4 + 9) dA = √14 dA, so dropping the root shrinks your answer by a factor of 3.74. The error scales with how tilted the surface is, which is why it survives a quick reread — the number still looks plausible.
  2. Using dt in place of ds. ∫f ds equals ∫f dt only when |r′(t)| = 1. On the quarter circle above |r′(t)| = 3, so the answer would have come out 6 instead of 18. Unit-speed parametrisations are the exception, not the rule.
  3. Guessing the normal direction. A flipped normal gives exactly −1 times the right answer, and the divergence theorem is stated for the outward normal specifically. If your flux disagrees with ∭∇·F dV only in sign, this is why.
  4. Applying the divergence theorem to an open surface. It requires a closed one. The fix is standard: add the cap that closes S, apply the theorem to the closed surface, then subtract the cap’s flux, which is usually trivial because the cap is flat. A triple integral calculator handles the volume side.
  5. Assuming zero curl means path-independent. It does not, unless the domain is simply connected. The standard counterexample is F = (−y/(x²+y²), x/(x²+y²)), which has zero curl everywhere it is defined, yet integrating it once counter-clockwise around the unit circle gives 2π rather than 0. The hole at the origin is doing all the work.

A dS Card for the Surfaces That Keep Appearing

Five surfaces cover the overwhelming majority of textbook problems. Memorise these and you will almost never need to grind out a cross product under exam pressure.

SurfaceParametrisationdS
Graph z = f(x, y)(x, y, f)√(1 + fx² + fy²) dA
Sphere, radius a(a sinφ cosθ, a sinφ sinθ, a cosφ)a² sinφ dφ dθ
Cylinder side, radius a(a cosθ, a sinθ, z)a dθ dz
Cone z = c√(x² + y²)(x, y, c√(x²+y²))√(1 + c²) dA
Plane region in xy(x, y, 0)dA

Two of these deserve a second look. The cone gives a constant stretch factor √(1 + c²) no matter where you are on it, which is why a cone unrolls flat onto paper and a sphere never will. And the a² sinφ on the sphere is the reason polar caps contribute so little: at φ near 0 the sine vanishes and the parametrisation is crowding an entire circle of points into almost no area. That sinφ is a Jacobian, exactly like the r in polar coordinates — the Jacobian calculator produces it if you would rather not derive it.

Once dS is in hand the rest is an ordinary iterated integral, which the double integral calculator and the surface integral calculator will finish. The setup was always the hard part; the integration is the part a machine can take from you.

Three to Test Yourself On

Work these before looking at anything else. Each one targets a different failure point.

  1. Find ∫C (x + y) ds where C is the straight segment from (0, 0) to (3, 4). (Answer: 17.5 — and note |r′| = 5, not 1.)
  2. Find the outward flux of F = (x, y, z) through the sphere of radius 2. (Answer: 32π. Do it directly using F·n = 2 on the surface, then again with the divergence theorem, where ∇·F = 3.)
  3. Find the surface area of the part of z = 6 − 2x − 3y lying above the triangle with vertices (0,0), (1,0), (0,1). (Answer: √14 / 2 ≈ 1.87, since the shadow has area ½.)

If all three come out right, the setup is no longer your bottleneck. If the second lands on −32π you took the inward normal; if the third lands on ½ you integrated the shadow instead of the surface. Both are errors from the list above, caught on problems small enough that the mistake is still visible.

Share this article

Help others discover this content

About the Author

Marko Šinko - Co-Founder & Lead Developer

Marko Šinko

Co-Founder & Lead Developer, AI Math Calculator

Lepoglava, Croatia
Advanced Algorithm Expert

Croatian developer with a Computer Science degree from University of Zagreb and expertise in advanced algorithms. Co-founder of award-winning projects, ensuring precise mathematical computations and reliable calculator tools.

Frequently Asked Questions

Still Have Questions?

The detailed content on this page provides comprehensive explanations and examples to help you understand better.