All Euler problems
Project Euler

Firecracker

A firecracker explodes at height h_0 = 100 m above flat ground, ejecting fragments in every direction at speed v_0 = 20 m/s. With gravity g = 9.81 m/s^2 and no air resistance, determine the volume...

Source sync Apr 19, 2026
Problem #0317
Level Level 08
Solved By 3,105
Languages C++, Python
Answer 1856532.8455
Length 260 words
geometryalgebramodular_arithmetic

Problem Statement

This archive keeps the full statement, math, and original media on the page.

A firecracker explodes at a height of \(100\,\mathrm {m}\) above level ground. It breaks into a large number of very small fragments, which move in every direction; all of them have the same initial velocity of \(20\,\mathrm {m/s}\).

We assume that the fragments move without air resistance, in a uniform gravitational field with \(g=9.81\,\mathrm {m/s^2}\).

Find the volume (in \(\metre ^3\)) of the region through which the fragments move before reaching the ground. Give your answer rounded to four decimal places.

Problem 317: Firecracker

Mathematical Foundation

Lemma 1 (Parametric Trajectory). A fragment launched at polar angle α\alpha from the upward vertical traces the trajectory (in cylindrical coordinates):

r(t)=v0sinαt,z(t)=h0+v0cosαt12gt2.r(t) = v_0 \sin\alpha \cdot t, \qquad z(t) = h_0 + v_0 \cos\alpha \cdot t - \tfrac{1}{2}g t^2.

Proof. The horizontal component of velocity is v0sinαv_0 \sin\alpha; the vertical component is v0cosαv_0\cos\alpha (upward). Under constant gravitational acceleration gg downward, Newton’s second law gives z¨=g\ddot{z} = -g. Integrating with initial conditions r(0)=0r(0) = 0, z(0)=h0z(0) = h_0, r˙(0)=v0sinα\dot{r}(0) = v_0\sin\alpha, z˙(0)=v0cosα\dot{z}(0) = v_0\cos\alpha yields the stated equations. \square

Theorem 1 (Envelope of Trajectories). The boundary of the reachable region is the paraboloid:

zmax(r)=Zgr22v02,Z:=h0+v022g.z_{\max}(r) = Z - \frac{g\,r^2}{2v_0^2}, \qquad Z := h_0 + \frac{v_0^2}{2g}.

Proof. Eliminate tt from the parametric equations. Set u=cotαu = \cot\alpha so that sin2α=1/(1+u2)\sin^2\alpha = 1/(1+u^2):

z=h0+rugr22v02(1+u2).z = h_0 + ru - \frac{gr^2}{2v_0^2}(1 + u^2).

This is quadratic in uu with negative leading coefficient gr2/(2v02)-gr^2/(2v_0^2). The maximum over uu occurs at z/u=0\partial z/\partial u = 0:

rgr2v02u=0    u=v02gr.r - \frac{gr^2}{v_0^2}\,u = 0 \implies u^* = \frac{v_0^2}{gr}.

Substituting uu^*:

zmax(r)=h0+rv02grgr22v02 ⁣(1+v04g2r2)=h0+v02ggr22v02v022g=h0+v022ggr22v02=Zgr22v02.\begin{align} z_{\max}(r) &= h_0 + r \cdot \frac{v_0^2}{gr} - \frac{gr^2}{2v_0^2}\!\left(1 + \frac{v_0^4}{g^2 r^2}\right) \\ &= h_0 + \frac{v_0^2}{g} - \frac{gr^2}{2v_0^2} - \frac{v_0^2}{2g} \\ &= h_0 + \frac{v_0^2}{2g} - \frac{gr^2}{2v_0^2} = Z - \frac{gr^2}{2v_0^2}. \quad \square \end{align}

Theorem 2 (Volume of the Reachable Region). The volume of the region is:

V=πv02Z2g,Z=h0+v022g.V = \frac{\pi v_0^2\,Z^2}{g}, \qquad Z = h_0 + \frac{v_0^2}{2g}.

Proof. The reachable region is bounded above by z=zmax(r)z = z_{\max}(r) and below by z=0z = 0. By axial symmetry, apply the disc method. From the envelope, r2(z)=2v02g(Zz)r^2(z) = \frac{2v_0^2}{g}(Z - z) for 0zZ0 \le z \le Z:

V=π0Zr2(z)dz=2πv02g0Z(Zz)dz=2πv02g[Zzz22]0Z=2πv02gZ22=πv02Z2g.\begin{align} V &= \pi \int_0^{Z} r^2(z)\,dz = \frac{2\pi v_0^2}{g}\int_0^{Z}(Z - z)\,dz \\ &= \frac{2\pi v_0^2}{g}\left[Zz - \frac{z^2}{2}\right]_0^Z = \frac{2\pi v_0^2}{g}\cdot\frac{Z^2}{2} = \frac{\pi v_0^2 Z^2}{g}. \quad \square \end{align}

Corollary (Numerical Evaluation).

Z=100+4002×9.81=100+2009.81=100+20.387359=120.387359Z = 100 + \frac{400}{2 \times 9.81} = 100 + \frac{200}{9.81} = 100 + 20.387359\ldots = 120.387359\ldots V=π×400×(120.387359)29.81=1856532.8455V = \frac{\pi \times 400 \times (120.387359\ldots)^2}{9.81} = 1856532.8455\ldots

Proof. Direct substitution of h0=100h_0 = 100, v0=20v_0 = 20, g=9.81g = 9.81 into Theorem 2. \square

Editorial

A firecracker at height h0 = 100m ejects fragments at v0 = 20 m/s in all directions. Find the volume of the reachable region (no air resistance, g = 9.81 m/s^2). The envelope of all parabolic trajectories forms a paraboloid of revolution: z_max(r) = Z - gr^2 / (2v0^2) where Z = h0 + v0^2 / (2*g) is the maximum height. Volume = pi * v0^2 * Z^2 / g. We return round(V, 4).

Pseudocode

Input: h0 = 100, v0 = 20, g = 9.81
Output: volume V to 4 decimal places
Z = h0 + v0^2 / (2 * g)
V = pi * v0^2 * Z^2 / g
Return round(V, 4)

Complexity Analysis

  • Time: O(1)O(1) — direct closed-form evaluation.
  • Space: O(1)O(1).

Answer

1856532.8455\boxed{1856532.8455}

Code

Each problem page includes the exact C++ and Python source files from the local archive.

C++ project_euler/problem_317/solution.cpp
#include <bits/stdc++.h>
using namespace std;

/*
 * Problem 317: Firecracker
 *
 * V = pi * v0^2 * Z^2 / g
 * where Z = h0 + v0^2 / (2*g)
 *
 * h0 = 100, v0 = 20, g = 9.81
 */

int main(){
    double h0 = 100.0;
    double v0 = 20.0;
    double g = 9.81;

    double Z = h0 + v0 * v0 / (2.0 * g);
    double V = M_PI * v0 * v0 * Z * Z / g;

    printf("%.4f\n", V);
    return 0;
}