Examples of back of envelope calculations leading to good intuition? Some time ago, I read about an "approximate approach" to the Stirling's formula in M.Sanjoy's Street Fighting Mathematics. In summary, the book used a integral estimation heuristic from spectroscopy
$$\int_{\mathbb{R_{\ge 0}}} f(x) dx  \approx   \max(f) * (\text{point where}\ \frac{1}{2} \max(f)\  \text{is achieved}) $$
to estimate the Gamma function with $f(x) = f_t(x) = x^{t}e^{-x} $. This leads to the estimate
$$\Gamma(n) = \int_{\mathbb{R}_{\ge 0}} x^{n}e^{-x} dx \approx \sqrt{8 n} \left(\frac{n}{e}\right)^n$$
which is an extremely good estimate (the "proportionality constant" $\sqrt{8}$ is correct to within 10% with correct order of growth.) This heuristic was very helpful in understanding the growth of the actual formula $\Gamma(n) \approx \sqrt{2\pi n} \left(\frac{n}{e}\right)^n$.
I think approximations of this sort is useful because

*

*It gives a sense of what the answer "ought" to be.

*When the approximation deviates from the actual answer, it's interesting to think about which part of the approximation failed.

Another "back-of-envelope calculation" is the calculation for the Prime Number Theorem in Courant and Robbins, What is Mathematics?
My Question. I am looking for similar instances in mathematics where "back-of-envelope calculations" such as the above leading to good intuition in mathematics.
For the purpose of my question, let's require that the calculation addresses questions in pure mathematics (so, no physics, engineering, etc. since there seems to already be plenty of literature on this).
Edit: as per helpful feedback from Peter LeFanu Lumsdaine, I removed two requirements: "Does not require anything beyond, say undergraduate mathematics" and "Does not formalize into a rigorous proof."
Edit 2 (as per helpful discussion in the comments): part of what I am interested in is how people use various techniques to compute/approximate objects of interest. For instance, I think we can all agree that the use of integral approximation demonstrated above is quite creative (if not, a nonstandard way of approaching Stirling). In response to Meow, topological invariants for "similar" (homotopy equivalent, homeomomorphic, etc) mostly amounts to the "same sort" of argument, so I would count that as "one" approximation argument unless there is a particular example where the heuristic argument is highly nontrivial.
 A: Inspired by Stef's answer, here is an idea that may or may not fit the bill. (Especially the earlier version that asked for materials that don't go beyond undergraduate mathematics...)
In a first course on calculus, suppose you are trying to find the derivative of a parabolic function
$$f: x \mapsto ax^2 + bx + c$$
where $a,b,c \in \mathbb{R}$ and $a > 0$ for simplicity of presentation here. By "derivative" I mean, a real-valued function such that you plug in an $x$-value $p$ and get as its output the slope of the line tangent to the curve $f$ at the point $(p, f(p))$.
Looking at the graph of the parabola, we can see that the tangent lines have slope tending to negative infinity on the left, positive infinity on the right, and zero at the vertex. The intuition here starts with, the simplest function to my mind that goes from negative infinity to positive infinity while passing through zero once is a linear function.
Moreover, we know from high school algebra that the vertex of such a parabola is at $h = -\frac{b}{2a}$.
What linear function sends $h \rightarrow 0$? One idea is just to add its additive inverse to it (an intuition check indicates this won't work out); another idea is just to multiply by zero (again: an intuition check indicates this won't work out); and then there is this idea: clear the denominator and use the additive inverse of the numerator.
For $-\frac{b}{2a} \rightarrow 0$, this means multiplying by $2a$ and then adding $-(-b)$. In particular, it is the linear function:
$$x \mapsto 2ax + b$$
which, indeed, is the desired output for $f'$.
If this idea interests anyone, then I have a longer write-up in a journal of math education; you can find that article, without paywall, here: Looking Back to Support Problem Solving (Mathematics Teacher).
A: The Peierls argument (1936) for a first-order phase transition in the Ising model at sufficiently low temperature was originally written in the vein of a non-rigorous back-of-the-envelope calculation. I believe that Dobrushin visited Peierls some 20 years later to discuss his brief argument in a succesful attempt to make it a rigorous basis for 1st-order phase transitions in lattice models lacking a continuous symmetry: this line then evolved into Pirogov-Sinai theory. At any rate, the Peierls argument is very intuitive and in my opinion, one can abandon the crude belief that "partition functions of finite systems are analytic, so there's no phase transition at finite system size. This analyticity likely carries over to the thermodynamic limit" without troubles of conscience after learning of this argument.
Please feel free to edit this post to complete the historiography and get all the anecdotes correct.
A: Scaling arguments are extremely useful in analysis, PDEs, and geometric analysis. One simple example is the Gagliardo-Nirenberg inequalities, which are of the form
$$ \left(\int_{\mathbb{R}^n} |f|^a\,dx\right)^{\alpha}\left(\int_{\mathbb{R}^n}|f|^b\,dx\right)^{\beta} \le C\left(\int_{\mathbb{R}^n} |\nabla f|^c\,dx\right)^{\gamma} $$
The two sides must scale the same under rescalings of both $f$ and space ($x \mapsto \lambda x$). This tells you exactly what equations the exponents must satisfy. In particular, invariance under rescaling of $f$ implies that
$$ a\alpha + b\beta = c\gamma, $$
and rescaling space (i.e., change of variables by a dilation) implies that
$$ n(\alpha +\beta) = (n-c)\gamma. $$
In addition, we need to assume that $a, b, c$ are positive, $\gamma > 0$, and at least one of $\alpha$ and $\beta$ must be positive.
In differential geometry, the existence and form of local tensor invariants can be identified through normalization of local coordinates at a point. For example, you can "discover" the fact that there is no first order tensor invariant of a Riemannian metric and "discover" the Riemann curvature tensor as the only possible second order invariant through this process.
What I find beautiful about this is that, when you dig more deeply, you discover that this ties closely to the representation theory of $GL(n)$ and Young tableaux.
A: Finding the primitive of logarithm
Finding a primitive amounts to calculating an integral. Calculating an integral amounts to measuring the area under a curve. What is the area under the curve of $\ln$? We want to calculate the value: $$\int_1^x \ln(t) \text{d}t$$
What do we know about function $\ln$? We know that logarithm is an increasing function which goes to infinity, and we know that logarithm is a "slow" function.
How does "slow" translate on the back of an  envelope calculation, and how does it help us estimate the area under the curve?
On the back of our envelope, we will write the following thing: the curve of $\ln$ is flat. It's a horizontal line.

The curve is so flat that we can say: for a very large $x$, for almost every value $x_2 < x$, $\ln(x_2) \approx \ln(x)$. In other words, the graph of $\ln$ is made of two parts:

*

*a short vertical line that goes from $\ln(1) = 0$ to $\ln(1+\varepsilon) = \ln(x)$;

*a long horizontal line that goes from $\ln(1+\varepsilon) = \ln(x)$ to $\ln(x) = \ln(x)$.

Calculating the area under the curve becomes easy: it's the area of a rectangle. Thus:
$$\int_1^x \ln(t) \text{d}t \approx x \ln(x)$$
We have a candidate for our primitive! A possible primitive for $\ln$ is function $F$ given by: $F(x) = x \ln(x)$.
How close was our approximation? We can check our result by taking the derivative of $F$:
$$F'(x) = \ln(x) + 1$$
We're off by a constant term! Constant terms are easily removed. A correct primitive of $\ln$ is function $G$ given by: $$G(x) = x \ln(x) - x$$
A: Although requiring a bit more than undergraduate math, roughly a first course in algebraic number theory, I'd say that Pomerance's first calculations for the general number field sieve fit into this framework. Here's a quote from his 1996 article in the Notices of the AMS (middle of page 1480):

[the number field sieve for] general numbers? In the summer of 1989 I was to give a talk at the meeting of the Canadian  Number  Theory  Association ... On the plane on the way to the meeting I did a complexity analysis of the method  as  to  how  it  would  work  for  general numbers,  assuming  myriad  technical  difficulties did not exist ...  I  was  astounded.  The complexity for this algorithm-that-did-not-yet-exist   was   of   the   shape   $\exp\bigl(c(\log n)^{1/3}(\log\log n)^{2/3}\bigr)$. ... Clearly this method deserved some serious thought! I do not wish to give the impression that with this complexity analysis I had single-handedly found a way to apply the number field sieve to general composites. Far from it. I merely had a shrouded glimpse of exciting possibilities for the future

A: Knuth's probabilistic "proof" of the hook-length formula might qualify, though it's not an approximation as such.
Here we have a partition $\lambda$ of $n$. Recall a standard Young tableau of shape $\lambda$ is a filling of the boxes of the Ferrers diagram of $\lambda$ with the numbers $1, \dots, n$ such that the entries in each row and column are increasing when read left to right and top to bottom respectively. The hook of a box is the set of boxes to the right or below the box, including the box itself. Write $h(b)$ for the number of boxes in the hook of a box $b$. Clearly, a filling is standard if and only if the entry in each box is the smallest one in the hook of that box. Now there are $n!$ ways to fill the boxes with the numbers $1, \dots, n$ and if we choose such a filling at random the probability that box $b$ contains the smallest entry in its hook is clearly $1/h(b)$. Naïvely, we might conclude from this that the probability that the filling is standard is the product of these reciprocals of hook lengths and so the number of standard tableaux is $$|\mathrm{SYT}(\lambda)| = \frac{n!}{\prod_b h(b)}$$ but of course these events are not independent so it is illegitimate to just multiply their probabilities like this.  Despite this, the formula is exactly correct!
A: Minkowski theorem
The Poisson summation formula writes
$$\sum_{n \in \mathbb Z^n} \phi(n) = \sum_{n \in \mathbb Z^n} \widehat{\phi}(n)$$
where $\hat{\phi}$ is the Fourier transform of $\phi$. Let's take $\phi = \mathbf 1_A$ the characteristic function of a set $A$. Roughtly, the outcome is expected to be
$$
|A \cap \mathbb Z^n| = \sum_{x \in \mathbb Z^n} \mathbf{1}_A(x) = \sum_{x \in \mathbb Z^n} \widehat{\mathbf{1}_A}(x) \geqslant \widehat{\mathbf{1}_A}(0) = \mathrm{vol}(A),
$$
and this would prove that there are two distinct points of the lattice $\mathbb Z^n$ in $A$ as soon as $\mathrm{vol}(A)>1$: this is the idea of Minkowski's theorem. Of course, $\mathbf 1_A$ is not an admissible function in the Poisson summation formula and this idea has to be massaged a bit. Doing so, we realize that we need to assume some nice properties on $A$ (viz. convex and symmetric) and that the volume has to be a bit larger (viz. $2^n$).
Trace formulas
More generally, trace formulas enjoy a lot from these heuristics. They are distributional equalities of the form
$$\sum_{\lambda \in \mathrm{spec}} \phi(\lambda) = \sum_{\lambda \in \mathrm{geom}} \widehat{\phi}(\lambda)$$
where the left sum runs over "spectral" terms (e.g. automorphic forms, eigenvalues of the Laplacian), the right sum over "geometric terms" (e.g. geodesics, conjugacy classes) and $\hat{\phi}$ is an explicitly defined integral transform of $\phi$. They are in particular used to establish results on average, and the (illegal) use of characteristic functions on one side often gives you the right main term when estimating the trivial term on the other side (similarly to the $0 \in \mathbb Z^n$ above). Two examples on a compact surface $S$:

*

*if you take the characteristic function on the spectral side, you guess the Weyl law counting the eigenvalues of the laplacian $\Delta$:
$$|\{\lambda \in \mathrm{spec}(\Delta) \ : \ |\lambda| \leqslant X\}| \sim \frac{\mathrm{vol}(S)}{4\pi}X$$

*if you take the characteristic function on the geometric side, you guess the prime geodesic theorem counting the closed geodesics of bounded length $\ell$ on $S$:
$$|\{\gamma \text{ geodesic on } S \ : \ \exp(\ell(\gamma)) \leqslant X\}| \sim \mathrm{li}(X)$$
The extent of these ideas in geometry, number theory, automorphic forms, spectral theory, etc. is impressive, and these back of envelope calculations are a strong 'and reliable guide. (and, of course, turning these heuristics into proofs are another matter)
A: I think Flory's argument for the exponent for the mean-square displacement for the self-avoiding walk (SAW) qualifies as a back-of-the-envelope calculation which is surprisingly good.
Let $\omega(n)$ be the position after $n$ steps of the SAW starting at the origin, in the lattice $\mathbb{Z}^d$ (or some other lattice like the hexagonal one in $d=2$). A simple thermodynamic argument by Flory (see, e.g., page 6 of these notes) regarding the physics of polymer chains gives the prediction
$$
\mathbb{E}\ |\omega(n)|^2\ \simeq C\ n^{2\nu}
$$
when $n\rightarrow\infty$ with
$$
\nu=\frac{3}{d+2}\ .
$$
The OP may not like this since this could be viewed as "physics" and not "pure mathematics", but I think the rigorous study of these asymptotics (see, e.g., these slides) is very hard and very pure mathematics.
A: There's a back of an envelope calculation by Beckenstein in thinking how the area of a black hole can be interpreted  as a measure of entropy, the underlying assumption being that the laws of thermodynamics is correct.
After Stephen Hawkings more thorough calculation using QFT on curved manifolds, a semi-classical calculation, we know that he was correct upto a proportionality factor. The calculation is referred to in Leonard Susskinds The Black Hole Wars: My Battle to Make The World Safe for Quantum Mechanics, a popular book.
A different kind of back of the envelope calculation was done by Newton when Johann Bernoulli described as a challenge the Brachistochrone problem in 1696 in the Acta Eruditorium, allowing six months for a solution. When none was forthcoming he extended the deadline by another year at the request of Leibniz. Soon after, Newton discovered the problem after coming home from the mint, stayed up all night to solve it, and sent the solution out by next post anonymously. Why, I have no idea. When Bernoulli saw the solution he recognised who its author must be and said:

We recognise a lion from his claw-marks.

Johann Bernoulli had already solved the problem before setting it. Apparently it had taken him two weeks to solve it.
There is also an anecdote by Feynman where he did a sequence of rapid calculations when he was faced by a philosopher and his 'adoring' students who asked him a sequence of pointed questions. I don't recall the details now - but will leave this as a place-holder until I do.
A calculation need not be numerical, it could be algebraic: and one such was done by Peierls in his 16 page note which showed how to define a covariant commutator in QFT unlike the equal-times commutator so often used in QFT. De Witt called this the global commutator.
