Ask HN: What is your favorite equation?

45 points by pcarolan ↗ HN

69 comments

[ 2.2 ms ] story [ 124 ms ] thread
Navier-Stokes. Always had a thing for fluid mechanics.
Same here. I'm with Heisenberg, "When I meet God, I am going to ask him two questions: Why relativity? And why turbulence? I really believe he will have an answer for the first."
Same! Naiver-Stokes & Lattice Boltzmann.
Kajiya's rendering equation
If you asked for Theorems, god the conversation we'd be having.

For equation, probably, Maxwell's equations, because I use them in my research.

While not really a mathematical "equation", the Drake equation, simply for the debate it causes and the ramifications of parameter changes on what we think of as a race.
It is an equation, albeit probably flawed somewhere down the line.

N = R* • fp • ne • fl • fi • fc • L

https://en.wikipedia.org/wiki/Drake_equation

An excellent use of rough statistics to shatter long held beliefs. Even if life is incredibly rare, it most certainly exists somewhere else.

This equation was the first serious attempt to quantify the number of civilizations in our universe. As we explore Europa and others, we will get some serious data points to improve our understanding of the origin of life in the universe.
Euler's Identity. There is so much mathematical content in such a small equation.
euler's identity e^ipi+1=0 of course. it connects all the dots (e, pi, sqrt(-1), 1, 0), is fun to prove, and just plain cool. i have no idea of its practical applications though.
In the form you wrote it, there are no real applications. But, written as $e^{i\theta} = \cos \theta + i \sin \theta$, it's frequently used in complex analysis and other areas.
It's really just a nice result of euler's theorem:

    e^(a * i) = cos(a) + i * sin(a)
Where `a` is the angle in radians and `i` is `sqrt(-1)`
A math professor of mine once said of this (paraphrased): yes it is cool, but really it is just a trivial consequence of how we defined our extension of the real exponential map to complex numbers. The really cool part, is that this extension is the _only_ possible holomorphic (differentiable for complex numbers) extension. All that to say that the really nifty part of this identity is the uniqueness of analytic continuations (on the whole complex plane).
Well, pi in there is a special case. The general case for any angle $\theta$ is $e^{\i\theta}=\cos(\theta)+\i\sin(\theta)$ It lets you transform between rectangular and polar representations of complex numbers. That allows for things like phasors [1] which are used quite a lot in electrical engineering. It's also used in Fourier analysis, IE all sorts of digital signal processing. Basically anywhere you get complex numbers, sines, or cosines, Euler's formula shows up. That's a lot of places in math/physics/engineering.

[1] https://en.wikipedia.org/wiki/Phasor

V - E + F = 2 - 2g, the defining equation for the genus/Euler characteristic of a surface. It has applications all throughout topology and graph theory.
When I first started chatting online with the woman to whom I'm married, she told me that she had a single tattoo, and that it was of an equation.

I immediately guessed Euler's identity and wrote "$e^{i\pi}+1=0$"

That was when we knew it was serious.

I got lucky (in more ways than one) because she'd nearly gone with her other choice, the continuum hypothesis

Euler's equation is cool... Written properly it contains addition, negation, multiplication, exponentiation, the imaginary unit, the additive identity, the multiplicative identity, the natural anti-derivative identity, and two irrational transcendental numbers in a most compact form with holomorphic continuity.
Was this a random stranger you started chatting with online or did you know her in real life before?
We had exchanged messages on okcupid and had progressed to gchat. At the time she was in New York and I was in Seattle
The rendering equation. Because the fact that it's hard to evaluate means I have a job.
The normal equation: https://essentialproject.files.wordpress.com/2013/12/normal-...

used to find the line of best fit.

The first time I saw it I was in high school and I was watching Andrew Ng's machine learning class for the first time. My Math background was not the best and I didn't fully understand it until a couple of years later when I took MIT's free online course on linear algebra (OCW 18.06)

For the interested: take `B` to be the matrix minimizing `(Y - XB)'(Y - XB)` (the least squares aka the "best fit"), then `B = (X'X)^-1 X'Y`.

Proof: Since `B` is a minimum, the derivative of the expression minimized wrt `B` must be zero (the "derivative" is taken in the matrix sense here).

    0 = d/dB [ (Y - XB)'(Y - XB) ]
      = d/dB [ Y′Y − Y′XB − B′X′Y + B′X′XB ]
      = d/dB [ Y′Y − 2Y′XB + B′X′XB ]            Y′XB and B′X′Y are just scalars :)
      = − 2Y′X + 2′X′XB
Solving for `B` you get the result.

[1] https://isites.harvard.edu/fs/docs/icb.topic515975.files/OLS...

This is also known as the (Moore-Penrose) Pseudoinverse.
At some point in my past I became biased towards inequalities over equalities; they somehow seemed more fundamental (I have no intention to defend this sentiment... its probably insubstantial). So there are lots of fun inequalities, but probably my favorite is the bound on the support of eigenvalues of a matrix given by the Gershgorin circle theorem (https://en.wikipedia.org/wiki/Gershgorin_circle_theorem).
"all animals are equal, but some animals are more equal than others"
It looks like an equation, but it's really almost a Y combinator, almost in Haskell:

     y f = f (y f)
Though this won't exactly type check, it's a pithy reminder of what I found so powerful about functional programming, which is that _any_ repetition in the code ought to be something you could factor out. The Y combinator shows you that _even the idea of a function calling itself_ can be factored out. It's hard to imagine you would really ever be forced to repeat yourself if this can be factored out.

Of course that isn't the real point of the Y combinator, but this thought, this "equation" completely changed the way I think about programming.

That does typecheck though!
Much along the same lines, I'm fascinated by Turing's Theta Combinator (another fixed point combinator from lambda calculus).
This works in Haskell just fine, thank you very much!

    ghci> y f = f (y f)
    ghci> factorial = y (\f x -> if x == 0 then 1 else x * f (x-1))
    ghci> factorial 5
    120
However, the Y combinator as defined in a non-recursive form is tougher to implement in Haskell [1][2]. It looks a lot better in Racket (and this is coming from someone who doesn't particularly like Racket).

    (λ (r) (λ (h) (h h)) (λ (g) (r (λ (x) (g g) x))
[1] http://stackoverflow.com/a/5885270/3072788 [2] http://stackoverflow.com/a/13119751/3072788
Del dot B = 0

Gauss's law for magnetism is so simultaneously simple and profound at the same time. It says that there is no such thing as magnetic charge (monopole).

Surprised no one's mentioned Bayes's Theorem yet. It's so incredibly simple yet underpins so much of statistics.
Euler's formula. This one formula is the most practical formula I've ever encountered. Once you learn it, you will never stop using it. The Schrodinger equation is a lot of fun, but you will likely stop using it if you stop doing quantum mechanics. Maxwell's equations are beautifully simple and tend to appear in many other contexts other than classical electrodynamics. For example, in the absence of charge, Maxwell's equations describe free waves -- which can appear in many contexts other than electromagnetic fields.
e=mc^2

Just the fact that energy can be converted to mass and mass can be converted into energy is very interesting

Also, momentum and energy are equivalent in some sense.

E² = m²c⁴ + p²c²

Just to clarify, mass-energy equivalence implies nothing about mass-energy conversion. We've never witnessed such a conversion nor do we know if it's possible. The implication is that mass difference of an atom after energy absorption is directly proportional to the energy absorbed. Energy is still energy in that case, no conversion has taken place.
e=mc^2

Just the fact that energy can be converted to mass and mass can be converted into energy is very interesting

The Riemann Curvature Tensor (of General Relativity) written in Christoffel symbols is quite beautiful. https://en.wikipedia.org/wiki/Ricci_curvature

Using Einstein summation notation and covariant (raising and lowering operator) derivatives the curvature of spacetime can be compactly described.

    d^2/dx^2 sin(x) = -sin(x)
This means that sin(x) is an eigenfunction of the second derivative operator in the infinite dimensional vector space of functions.

This little fact makes numerically solving second-order differential equations using a sin(x) basis really cheap, just need to pay the upfront FFT cost... (O(n log n))