---
title: "Continuity equation in Cartesian coordinates"
subject: "Fluid Mechanics"
chapter: 4
key: "semester_4/fluid_mechanics_mechanical:continuity-equation-cartesian-derivation"
source: https://www.bctengineer.com/q/semester_4/fluid_mechanics_mechanical/continuity-equation-cartesian-derivation
site: BCT Engineering
---

# Continuity equation in Cartesian coordinates

Fluid Mechanics · Chapter 4: Basic Equations for Fluid Flow

- Asked in: year not given, 6 marks
- Video: [continuity equation in 3 dimensions](https://www.youtube.com/watch?v=jn_g6cW9r0w) — GTU MIMP
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_4/fluid_mechanics_mechanical/continuity-equation-cartesian-derivation
- Whole chapter: https://www.bctengineer.com/md/semester_4/fluid_mechanics_mechanical/chapter-4

## Question

Derive the three-dimensional differential continuity equation in Cartesian coordinates for a compressible fluid. Reduce it for steady flow and for incompressible flow.

## Short answer

For a compressible fluid, the continuity equation is ∂ρ/∂t + ∂(ρu)/∂x + ∂(ρv)/∂y + ∂(ρw)/∂z = 0. For steady flow, ∂ρ/∂t =0 leaving ∇·(ρV)=0. For incompressible flow (ρ constant), it reduces to ∂u/∂x + ∂v/∂y + ∂w/∂z = 0.

## Answer

#### Statement
The continuity equation expresses conservation of mass: the net rate of mass flowing out of a control volume equals the rate of decrease of mass inside it.

#### Derivation
Consider a fixed elemental control volume $dx\,dy\,dz$ in a flow with velocity $\vec V = u\hat i + v\hat j + w\hat k$ and density $\rho$.

```text
          y
          ^      _______
          |    /|      /|
          |   /_|_____/ |   dz
          |  |  |____|__|
          |  | /     | /  dy
          |  |/______|/
          +--------------> x
               dx
```

Mass inflow through the face perpendicular to $x$ (area $dy\,dz$) is $\rho u\,dy\,dz$. Mass outflow through the opposite face is

$$
\left[\rho u + \frac{\partial(\rho u)}{\partial x}dx\right]dy\,dz
$$

Net outflow in the $x$-direction is $\dfrac{\partial(\rho u)}{\partial x}dx\,dy\,dz$. Similarly for $y$ and $z$. Total net outflow:

$$
\left[\frac{\partial(\rho u)}{\partial x} + \frac{\partial(\rho v)}{\partial y} + \frac{\partial(\rho w)}{\partial z}\right]dx\,dy\,dz
$$

Rate of decrease of mass in the element: $-\dfrac{\partial\rho}{\partial t}dx\,dy\,dz$.

Equating:

$$
\frac{\partial\rho}{\partial t} + \frac{\partial(\rho u)}{\partial x} + \frac{\partial(\rho v)}{\partial y} + \frac{\partial(\rho w)}{\partial z} = 0
$$

or in vector form, $\dfrac{\partial\rho}{\partial t} + \nabla\cdot(\rho\vec V) = 0$.

#### Special cases
- **Steady flow** ($\partial\rho/\partial t = 0$):

$$
\frac{\partial(\rho u)}{\partial x} + \frac{\partial(\rho v)}{\partial y} + \frac{\partial(\rho w)}{\partial z} = 0
$$

- **Incompressible flow** ($\rho$ constant, steady or unsteady):

$$
\frac{\partial u}{\partial x} + \frac{\partial v}{\partial y} + \frac{\partial w}{\partial z} = 0 \quad \text{i.e. } \nabla\cdot\vec V = 0
$$

- For 2D incompressible flow: $\partial u/\partial x + \partial v/\partial y = 0$.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. The continuity equation is derived by applying which principle to a fixed elemental control volume?
   A. Conservation of energy
   B. Conservation of mass: net outflow equals rate of decrease of mass inside
   C. Conservation of momentum
   D. Newton's law of viscosity
   Answer: B. Net mass outflow rate equals the rate of decrease of mass within the element. (Key point: Principle of the derivation)

2. The general 3D continuity equation for compressible fluid is:
   A. d(rho u)/dx + d(rho v)/dy + d(rho w)/dz = 0
   B. drho/dt + d(rho u)/dx + d(rho v)/dy + d(rho w)/dz = 0
   C. drho/dt = 0 only
   D. du/dx + dv/dy + dw/dz = drho/dt
   Answer: B. The net outflow terms plus the rate of density change inside the element sum to zero. (Key point: Compressible continuity equation)

3. For incompressible flow (steady or unsteady) the equation reduces to:
   A. du/dx + dv/dy + dw/dz = 0
   B. d(rho u)/dx = 0 only
   C. drho/dt = 0 only
   D. u + v + w = 0
   Answer: A. With constant rho it divides out, leaving div V = 0; the steady compressible case keeps density inside the derivatives. (Key point: Reduction for incompressible flow)

## Related in Fluid Mechanics

- [Continuity in cylindrical coordinates, radial flow](https://www.bctengineer.com/question.md?key=semester_4%2Ffluid_mechanics_mechanical%3Acontinuity-cylindrical-radial-flow) — Fluid Mechanics, chapter 4
- [Types of flow, streamline, pathline, streakline](https://www.bctengineer.com/question.md?key=semester_4%2Ffluid_mechanics_mechanical%3Aflow-types-streamline-pathline-streakline) — Fluid Mechanics, chapter 3
- [Acceleration of a fluid particle](https://www.bctengineer.com/question.md?key=semester_4%2Ffluid_mechanics_mechanical%3Aparticle-acceleration-unsteady-field) — Fluid Mechanics, chapter 3
- [Fluid properties and flow description methods](https://www.bctengineer.com/question.md?key=semester_4%2Ffluid_mechanics_mechanical%3Afluid-newtonian-lagrangian-eulerian) — Fluid Mechanics, chapter 1
- [Pressure variation in a static fluid](https://www.bctengineer.com/question.md?key=semester_4%2Ffluid_mechanics_mechanical%3Apressure-variation-static-fluid) — Fluid Mechanics, chapter 2
- [Navier-Stokes equations for Newtonian fluid](https://www.bctengineer.com/question.md?key=semester_4%2Ffluid_mechanics_mechanical%3Anavier-stokes-newtonian-fluid) — Fluid Mechanics, chapter 4

## Related in other subjects

- [Derive differential continuity equation](https://www.bctengineer.com/question.md?key=semester_7%2Fapplied_computational_fluid_dynamics%3Acontinuity-equation-differential-form) — Applied Computational Fluid Dynamics, chapter 2
- [General heat conduction equation in Cartesian coordinates](https://www.bctengineer.com/question.md?key=semester_5%2Fheat_transfer%3Ageneral-heat-conduction-equation-cartesian) — Heat Transfer, chapter 2
- [Derive continuity equation for unsteady pipe flow](https://www.bctengineer.com/question.md?key=semester_4%2Fhydraulics%3Acontinuity-equation-unsteady-pipe-flow) — Hydraulics, chapter 4
- [Derive one-dimensional heat equation](https://www.bctengineer.com/question.md?key=semester_4%2Fapplied_mathematics%3Aheat-eq-derive) — Applied Mathematics, chapter 3, asked 5×
