Q: How do I know my windmill is on straight?

The original question was:

I got quite the challenge from my father in law. The problem is well defined, but I’m having difficulties finding a meaningful answer. The reason why he asked me is because I’m an engineering student and he is in the windmill industry.

Before they attach the actual mill on the concrete foundation, it has to be absolutely leveled. If not, a tall mill would be quite offset even with a very small angle. To tackle this, they use two angle gauges and measure in two directions. The angle gauges are connected and you know the angle between them, their mutual angle. I’m supposed to find a way to convert these 3 inputs (angle 1, angle 2 and mutual angle) to find 2 outputs (the steepest angle and in which direction this is relative to the gauges).

Physicist: This is a gorgeous question that leads through some pretty math and ends with an elegant answer.  If you’ve taken a class or two that used lots of vectors, then this is a cute exploration of what you can do with surprisingly little.  If you’ve never taken a class or two that used lots of vectors, then please do: it’s fun stuff.  You get to draw pictures and everything.

So you’ve got a flat slab that isn’t quite level.  Two angle gauges (with plumb lines or bubbles or whatever) are placed on the slab in two directions.  Define \vec{a} and \vec{b} as the directions of the two gauges on the ground and \vec{u} as up.  These may as well be unit vectors, so: they are.

An angle gauge or "inclinometer".

An angle gauge or “inclinometer”.

Define the angle between \vec{a} and \vec{b} as \phi and the angle between each each of the levels and \vec{u} as \theta_a and \theta_b.

Measuring the angles between these vectors means that we know sine and cosine of these angles, and knowing that means that we know the dot product and magnitude of the cross product, since \vec{a}\cdot\vec{b} = |\vec{a}||\vec{b}|\cos{(\phi)} = \cos{(\phi)} and |\vec{a}\times\vec{b}| = |\vec{a}||\vec{b}|\sin{(\phi)} = \sin{(\phi)}.

Finally, since the windmill will be built perpendicular to the slab, it will be built perpendicular to both \vec{a} and \vec{b}.  When a physicist (hell, even a mathematician) hears “I need a vector perpendicular to two other vectors” they convulsively respond “cross product those mothers”.  If \vec{w} is the windmill’s “up”, then \vec{w} = \vec{a}\times\vec{b}.  If you were standing on the slab where the tails of \vec{a} and \vec{b} meet, then \vec{a} would be on the right and \vec{b} would be on the left (that’s the right hand rule).

A pristine windmill polluted with a mess of vectors.

A pristine windmill, slanted, and polluted with a mess of vectors.

If we project \vec{u} onto the \vec{a}, \vec{b} plane, the result will be pointing in the direction opposite the direction of the windmill’s lean.  Define this projection as \vec{p}.  The direction of \vec{p} is the direction that the windmill needs to be “leaned” so that it will stand straight.

The questions (way back at the top of this page) now boil down to:

1) What is the angle between \vec{w} and \vec{u}?

2) What is the angle between \vec{p}, and \vec{a} and \vec{b}?

For #1, it turns out that the cross product is easier to work with.  Define \Omega as the angle between \vec{w} and \vec{u}.

\begin{array}{ll}  |\vec{w}\times\vec{u}|^2 \\[2mm]  = |(\vec{a}\times\vec{b})\times\vec{u}|^2 \\[2mm]  = |(\vec{u}\cdot\vec{a})\vec{b} - (\vec{u}\cdot\vec{b})\vec{a}|^2 & \textrm{(nobody can remember this identity)} \\[2mm]  = (\vec{u}\cdot\vec{a})^2|\vec{b}|^2 + (\vec{u}\cdot\vec{b})^2|\vec{a}|^2 - 2(\vec{u}\cdot\vec{a})(\vec{u}\cdot\vec{b})(\vec{a}\cdot\vec{b}) \\[2mm]  = (\vec{u}\cdot\vec{a})^2 + (\vec{u}\cdot\vec{b})^2 - 2(\vec{u}\cdot\vec{a})(\vec{u}\cdot\vec{b})(\vec{a}\cdot\vec{b}) \\[2mm]  = \cos^2{(\theta_a)} + \cos^2{(\theta_b)} - 2\cos{(\theta_a)}\cos{(\theta_b)}\cos{(\phi)} \\[2mm]  \end{array}

We also know that:

\begin{array}{ll}  |\vec{w}\times\vec{u}|^2 \\[2mm]  = |\vec{w}|^2|\vec{u}|^2\sin^2{(\Omega)} \\[2mm]  = |\vec{w}|^2\sin^2{(\Omega)} \\[2mm]  = |\vec{a}\times\vec{b}|^2\sin^2{(\Omega)} \\[2mm]  = |\vec{a}|^2|\vec{b}|^2\sin^2{(\phi)}\sin^2{(\Omega)} \\[2mm]  = \sin^2{(\phi)}\sin^2{(\Omega)} \\[2mm]  \end{array}

And therefore:

\sin^2{(\phi)}\sin^2{(\Omega)} = \cos^2{(\theta_a)} + \cos^2{(\theta_b)} - 2\cos{(\theta_a)}\cos{(\theta_b)}\cos{(\phi)}

In the event that \phi=90^o (and honestly, why wouldn’t you want your gauges perpendicular?), then this simplifies a lot:

\sin^2{(\Omega)} = \cos^2{(\theta_a)} + \cos^2{(\theta_b)}

For #2 we find the projection, \vec{p}, and dot it with \vec{a} and \vec{b}.  The projection onto the slab is \vec{p} = \vec{u} - \frac{\vec{u}\cdot\vec{w}}{|\vec{w}|^2}\vec{w}.  That is; it’s the up direction minus whatever component points in the direction of the windmill.

\begin{array}{ll}  \vec{a}\cdot\vec{p} \\[2mm]  = \vec{a}\cdot\left(\vec{u} - \frac{\vec{u}\cdot\vec{w}}{\vec{w}\cdot\vec{w}}\vec{w}\right)\\[2mm]=\vec{a}\cdot\vec{u}-\frac{\vec{u}\cdot\vec{w}}{\vec{w}\cdot\vec{w}}\vec{a}\cdot\vec{w}\\[2mm]=\vec{a}\cdot\vec{u}  \end{array}

In that last step you know that \vec{a}\cdot\vec{w}=0 since the tower, \vec{w}, and any direction on the slab it’s on, like \vec{a}, are perpendicular.

Defining \omega_a as the angle between the projection  and \vec{a},

\begin{array}{ll}  (\vec{a}\cdot\vec{p})^2 = |\vec{a}|^2|\vec{p}|^2\cos^2{(\omega_a)} \\[2mm]  \Rightarrow (\vec{a}\cdot\vec{u})^2 = |\vec{p}|^2\cos^2{(\omega_a)} \\[2mm]  \Rightarrow \cos^2{\theta_a}=\left|\vec{u} - \frac{\vec{u}\cdot\vec{w}}{|\vec{w}|^2}\vec{w}\right|^2\cos^2{(\omega_a)} \\[2mm]  \Rightarrow \cos^2{\theta_a}=\cos^2{(\omega_a)}\left(|\vec{u}|^2 + \left(\frac{\vec{u}\cdot\vec{w}}{|\vec{w}|^2}\right)^2|\vec{w}|^2 - 2\frac{\vec{u}\cdot\vec{w}}{|\vec{w}|^2}\vec{u}\cdot\vec{w}\right) \\[2mm]  \Rightarrow \cos^2{\theta_a}=\cos^2{(\omega_a)}\left(1 + \frac{(\vec{u}\cdot\vec{w})^2}{|\vec{w}|^2} - 2\frac{(\vec{u}\cdot\vec{w})^2}{|\vec{w}|^2}\right) \\[2mm]  \Rightarrow \cos^2{\theta_a}=\cos^2{(\omega_a)}\left(1-\frac{(\vec{u}\cdot\vec{w})^2}{|\vec{w}|^2}\right) \\[2mm]  \Rightarrow \cos^2{\theta_a} = \cos^2{(\omega_a)}\left(1 - \frac{|\vec{u}|^2|\vec{w}|^2}{|\vec{w}|^2}\cos^2{(\Omega)}\right) \\[2mm]  \Rightarrow \cos^2{\theta_a} = \cos^2{(\omega_a)}\left(1 - \cos^2{(\Omega)}\right) \\[2mm]  \Rightarrow \cos^2{\theta_a} = \cos^2{(\omega_a)}\sin^2{(\Omega)}  \end{array}

Again, in the event that \phi = 90^o, this simplifies:

\begin{array}{ll}  \cos^2{\theta_a} = \cos^2{(\omega_a)}\sin^2{(\Omega)} \\[2mm]  \Rightarrow \cos^2{\theta_a} = \cos^2{(\omega_a)}\left(\cos^2{(\theta_a)} + \cos^2{(\theta_b)}\right) \\[2mm]  \Rightarrow \cos^2{\theta_a}\left(1-\cos^2{(\omega_a)}\right) = \cos^2{(\omega_a)}\cos^2{(\theta_b)} \\[2mm]  \Rightarrow \cos^2{\theta_a}\sin^2{(\omega_a)} = \cos^2{(\omega_a)}\cos^2{(\theta_b)} \\[2mm]  \Rightarrow \tan^2{(\omega_a)} = \frac{\cos^2{(\theta_b)} }{\cos^2{(\theta_a)}} \\[2mm]    \Rightarrow \left|\tan{(\omega_a)}\right| = \left|\frac{\cos{(\theta_b)} }{\cos{(\theta_a)}}\right| \\[2mm]  \end{array}

Similarly, \left|\tan{(\omega_b)}\right| = \left|\frac{\cos{(\theta_a)} }{\cos{(\theta_b)}}\right|.

So, if you’ve got the inclinometer readings, \theta_a and \theta_b, then you can find the lean of the tower, \Omega, and the direction you should push it so that it doesn’t lean, \omega_a and \omega_b from \vec{a} and \vec{b} respectively.  This is a beautiful example of math leading to a cute, relatively simple solution that you probably couldn’t guess.


The windmill picture is from here.

Posted in -- By the Physicist, Engineering, Equations, Geometry, Math | 2 Comments

Q: If all matter originated from a single point, does that mean all matter is entangled?

The original question was: All matter originated from a single point, does that mean all matter is entangled? If it is why do you need to create new entangled practices when doing experiments? Are there different types or degree’s of entanglement?

Physicist: There are absolutely different degrees of entanglement!

The degree you usually hear about are “maximally entangled states”, but basically everything is a little entangled. Not because of the big bang, but because every-day interactions generate and break a little entanglement all the time. Entanglement has a lot in common with correlation: if you know something about one thing, you’ll know something about the things it’s correlated with.

Correlations crop up all the time when things interact. For example, if you leave your car in a parking lot and come back to find a dent with a little red paint in it, then you know that somewhere nearby is a red car with another dent.  The random things about your dent (the height above the ground, the severity, etc.) will be similar to those properties of the corresponding dent on the other car.  You and a damnable ne’er-do-well have correlated cars because looking at the dent on one tells you something about the dent on the other; not because they have a spooky cosmic connection, but because they physically ran into each other. Entanglement is a little more subtle (what with all the quantum mechanics), but not a hell of a lot more subtle. Nothing fancy.

Just to be over-precise, when we say that things are entangled what we really mean is that some of their properties are entangled.  For example, the polarization of two photons might be entangled while their positions are not, or vice versa.

The homogeneity of the universe (the “more-or-less-the-same-everywhere-ness” of the universe) is often cited as evidence that all the matter in the very early universe briefly had a chance to mix around, but that doesn’t have too much of an impact on entanglement. There’s something called “monogamy of entanglement” that says that maximally entangled qubits only appear in pairs, and maximally entangled states are the ones that really do interesting things. This can be generalized a bit to say “the more entangled two things are, the less they’re entangled with anything else”. Unfortunately, in order for such a pair to persist until today it would need to be left almost entirely unharrassed by everything else for billions of years. However, if the universe is anything, it’s old and messy.  The entanglement we (people) create on purpose requires careful isolation and control of the stuff in question.

Even worse, if you have access to only one entangled particle, there’s no way to tell that it’s entangled. All of the fancy effects you hear about entanglement always require both, or at least most, of the entangled particles.

So you (every bit of you) can be entangled with other stuff in the universe (you kinda have to be). Entanglement is generated and broken by interactions, so you’re more entangled with stuff that’s nearby (in an astronomical sense). But most importantly, it doesn’t matter; random atomic-scale correlations are a lot like random atomic-scale noise.

Even less exciting, if you (personally) are the thing that’s entangled, your experience is entirely ordinary; the thing you’re entangled with will always be in a single state (from your point of view). All of the fancy experiments we do with entangled particle always involve particles being entangled with each other, because when they become entangled with the person doing the experiment it looks like “wave function collapse” (suddenly it appears to be in only one state) and that’s boring. Similarly, if you and a distant alien are entangled it does not mean you have a spooky connection (groovy, spiritual, or otherwise), it means that they will already be in a single state (from you mutual points of view) before you ever meet each other.

Which is exactly the sort of thing you’d never notice.

Posted in -- By the Physicist, Physics, Quantum Theory | 4 Comments

Q: How good is the Enigma code system compared to today’s publicly available cryptography systems?

Physicist: Freaking terrible.

The Enigma machine used a “rolling substitution cypher” which means that it was essentially a (much more) complicated version of “A=1, B=2, C=3, …”.  The problem with substitution cyphers is that if parts of several messages are the same then you can compare their similarities to break the code.  Enigma was broken in part because of German formality (most messages started with the same formal greeting).  Even worse, since some letters are more common than others (e.g., “e” and “g”) you can make progress by just counting up how often letters show up in the code (or even get an idea of what language the code is written in without breaking it!).  Substitution cypher are so easy to break that some folk do it for funRolling substitution cyphers can use a set of several encoding schemes and cycle through which code is used or make the scheme dependent on the previous letter, but this merely makes the code breaking more difficult.  Ultimately, all substitution cyphers suffer from the same difficulty: similar messages produce similar looking codes.

Enigma used three rotors which rotated after each letter was pressed allowing them to generate a huge number of different codes, using a different one for each letter.  Still: what your cellphone uses is much, much better.

Enigma used three rotors which rotated after each letter was pressed allowing them to generate a huge number of different substitution cyphers, using a different one for each letter.  Still: what your cellphone uses is much, much better.

Modern cryptography doesn’t have that problem.  If any part of a message is different at all, then the entire resulting code is completely different from beginning to end.  That is; if you encrypted a message, you’d get cypertext (the encoded message) and if you were to encrypt the exact same message but misspelled a single word, then the cypertext would be completely different.

If your messages were “Hello A”, “Hello B”, and “Hello C”, then a substitution cypher might produce “Tjvvw L”, “Tjvvw C”, and “Tjvvw S” while RSA (the most common modern encryption) might produce “idkrn7shd”, “62hmcpgue”, and “nchhd8pdq”.  In the first case you can tell that the messages are nearly the same, but in the second you got nothing.

Enigma was very clever but is shockingly primitive compared to modern crypto techniques.  If anyone in WW2 had been using modern (1970’s or later) encryption, then there is no way that anyone would have been able to break those codes (and Turing would have to settle for being famous for everything else he did).

There’s a post here that talks about the main ideas behind RSA encryption.  The really fancy stuff is some of the only math that isn’t publicly known.  Scientists have a whole thing about openness and the free exchange of information that governments and corporate entities (for whatever reason) don’t.

Posted in -- By the Physicist, Computer Science, Math, Number Theory, Paranoia | 7 Comments

Q: When “drawing straws” is it better to be first or last?

Physicist: As long as the person who cut the straws: 1) takes the last remaining straw and 2) has a decent poker face (or doesn’t know which is which), then it’s completely fair.  If they have a bad poker face, then it’s better to be first.

If the person who cuts and holds the straws has a terrible poker face, then the first few people have an advantage.

The quickest way to see why is to imagine a slightly different way of drawing straws.  Instead of drawing straws, draw cards where all but one are black (for example).  Everyone takes a card and afterward everyone turns their card over; the one red card is the “short straw”.  In this case it should make sense that no person is more or less likely to get the red card for the same reason that it’s no more or less likely for any particular card to be any particular place in a deck.  The fact that when drawing straws we pull one at a time and generally stop halfway through (whenever the short straws appears) makes it fell like the situation is different, but it’s not.

Say you’ve got N peeps (people).  The first person to draw a straw is the least likely to draw the short one (1/N) and the last to draw is the most likely (1/2).  However!  While the later people are more likely to draw the short straw, they’re also less likely to pull any straw since it’s more likely that the short straw has already been drawn.  In movies they almost always draw every straw because of drama, but in practice, you draw until the short one shows up and then you stop.

The early people are least likely to draw the short straw while the later people are least likely to draw at all.  If you write down the math you find that the effects balance out exactly.  So here’s the math written down:

You’ve got N peeps named One, Two, Three, etc. (probably siblings).

The first person has N straws to choose from and their probability of getting the short one is P=\frac{1}{N}.  Easy enough.  The second person has N-1 straws to choose from, so you might expect that their chance of drawing the short straw is P=\frac{1}{N-1}.  But that’s not the probability that counts.  What counts is the probability of drawing the short straw given that it hasn’t been drawn already.  That probability is P=\left(\frac{N-1}{N}\right)\left(\frac{1}{N-1}\right)=\frac{1}{N}.  $\frac{N-1}{N}$ is the probability that the first person did not already draw the short straw.

By the time it’s the Jth person’s turn there are N-J+1 straws remaining.  The probability that the short straw is among them (the probability that it hasn’t been drawn already) is \frac{N-J+1}{N}.  And if it hasn’t, then the probability of drawing it is \frac{1}{N-J+1}.  So, all in all, the probability of the Jth person drawing the short straw is P=\left(\frac{N-J+1}{N}\right)\left(\frac{1}{N-J+1}\right)=\frac{1}{N}.

Finally, the last person to draw is the person who cut the straws.  This person’s choice is random because everyone else’s choices were random: knowing which straw is which doesn’t change that.

Posted in -- By the Physicist, Math, Probability | 4 Comments

Q: What would happen if there was a giant straw connecting the Earth’s atmosphere right above the ground to space?

Physicist: About the same thing that happens to a straw in a glass of water: the water level in the straw evens out with the water level outside.

The pressure at the bottom of the straw "tells" the water in the straw how high to climb.  That same pressure "tells" the rest of the water the exact same thing.

The pressure at the bottom of the straw “tells” the water in the straw how high to climb. That same pressure “tells” the rest of the water the exact same thing.

A tube from the ground to space would fill with air of about the same density and pressure as the air around the straw, decreasing as you go up until eventually you have a straw full of nothing surrounded by also nothing (in space).

What holds the atmosphere to the planet is gravity, so if a patch of air tries to drift off into space it literally falls back.  A straw alone wouldn’t change that.  On the other hand, if you attached some kind of pump to the bottom of the straw to make it have a higher pressure than sea-level, then you could pump air up the straw and have some kind of massive space-fountain of air (the air coming out would fall back to Earth just like water in an ordinary fountain).  In fact!  There is a situation very close to that happening on Saturn’s moon, Enceladus.

The water-vapor fountains shoot directly into space.  Most of it falls back onto the ground.

The water-vapor geysers of Enceladus shoot directly into space. Most of it falls back onto the ground, but a tiny amount ends up orbiting Saturn and contributing to one of its rings.

Whenever air or water or whatever travels up a straw it’s being pushed by pressure from the bottom (there’s no such thing as sucking), and one atmosphere of pressure can only push so far.  For something like liquid mercury that’s about 76cm, which is why the “1 atmosphere” of pressure is often expressed as “760mm of Mercury”.  If a closed tube is taller than that, then the pressure (here on Earth) isn’t great enough to push the mercury to the top which leaves nothing at the top.

So that's mercury.

So that’s mercury.

Same idea with air.  If you have a long tube full of air with the top open to space and the bottom pressurized to one atmosphere (or 760mm Hg), then the column of air in the tube will be as tall as the atmosphere.

A straw doesn’t provide an “escape route”; our air is free to try to leave whenever.  The atmosphere stays where it is because it’s made of mass and the Earth has gravity.  It’s a little sobering to realize that there’s nothing between you and a profound nothing (space) but a thin layer of air held down by its own unimpressive weight.

The barometer picture is from here.

Posted in -- By the Physicist, Physics | 3 Comments

Q: Can a human being survive in the fourth dimension?

Physicist: Nopers.  But to understand why, it’s important to know what a dimension is.

When someone says “we live in the third dimension” what they should really say (to be overly-precise) is “the universe we inhabit has three spacial dimensions”.  There are a few ways that you can tell that you live in a three dimensional world.  The easiest is to try to come up with as many mutually-perpendicular directions as you can; you’ll find three without too much trouble, but you’ll never find a fourth.

These three directions are mutually perpendicular and and no new direction can be.

These three directions are mutually perpendicular and and no new direction can be perpendicular to all three.

If you’re feeling terribly clever, you’ll find lots of other examples that demonstrate the three (and not two or four) dimensionality of our universe.  For example, if you can tie a simple knot then you definitely live in three or more dimensions (no knots in 2-D) and if you can make a Klein bottle then you definitely live in four or more dimensions.

In 2-D you can't tie a knot without the rope passing through itself, and in 3-D you can't build a Klein bottle without essentially the same problem.

In 2-D you can’t tie a knot without the rope passing through itself, and in 3-D you can’t build a Klein bottle without the same problem.

A dimension is a direction.  Living in more dimensions means having more directions you can move in.  There are many weird physical consequences to living in more dimensions, but the one you’d notice first (if you were somehow to suddenly to appear in a 4-D universe) is immediate death.

An actual 2-D creature would collapse in 3-D, and there would be nothing to distinguish its outside form its inside.

An actual 2-D creature would collapse in 3-D.  What it considers to be its insides just looks like more surface to we 3-D folk.

If a paper doll (two-dimensional being) were suddenly brought into three dimensional space all of its innards would become outtards.  Similarly, there is nothing whatsoever supporting your body in a fourth direction, so if you were to find yourself with a few extra dimensions your insides would follow the path of least (zero) resistance and fall out.  It would be super gross, but would make no more of a mess than an infinitely thin oil slick.  Any local 4-D critters probably wouldn’t even notice.

Posted in -- By the Physicist, Math, Paranoia, Physics | 23 Comments