Note (12/2015): Hi there! I'm taking some time off here to focus on other projects for a bit. As of October 2016, those other projects include a science book series for kids titled Things That Make You Go Yuck! -- available at Barnes and Noble, Amazon and (hopefully) a bookstore near you!

Co-author Jenn Dlugos and I are also doing some extremely ridiculous things over at Drinkstorm Studios, including our award-winning webseries, Magicland.

There are also a full 100 posts right here in the archives, and feel free to drop me a line at secondhandscience@gmail.com with comments, suggestions or wacky cold fusion ideas. Cheers!

XOR


· Categories: Computers, Mathematics
What I’ve Learned:

XOR: 'THERE CAN BE ONLY ODD NUMBERS OF THINGS!'
“XOR: ‘THERE CAN BE ONLY ODD NUMBERS OF THINGS!'”

If you look closely enough, even really complicated mathematics breaks down into simple logic. And if you look at simple logic closely enough… well, it’s really freaking complicated.

Take the word “or”. We use “or” between things all the time. Cake or pie. French fries or onion rings. Coffee, tea or milk.

(And also between things that aren’t food, probably. I skipped lunch, so I’ve got a bit of a one-track stomach right now.)

Mostly, our “or”s mean you can have one thing or the other — but that’s not always true. This is the 21st century, and we’re in ‘Murrica, dadgummit, so if you want half fries and half rings, you can have it. Milk in your coffee? No problem. You want a pie baked inside a cake, on top of another cake with a pie in it?

Well, of course you do. Because ‘Murrica.

These ambiguous “or”s are fine in conversation — and in diners, bakeries and burger joints, apparently — but they won’t do when it comes to math and logic. For that, you need something more specific. More restrictive. You need XOR.

XOR — or “exclusive or”, if you like — is a logical operator that denotes the less generous sort of “or”. XOR is “or” with a mean disciplinarian streak. It’s the Ebenezer Scrooge of “or”. The angry ruler-wielding Catholic nun of “or”. And when separating two choices, XOR is the big ugly punk highlander of “or”: THERE CAN BE ONLY ONE!

In logical terms, a pairwise XOR represents the choice of “A or B, but not A and B”. But this is logic, so it’s not that simple. You can slip XORs between any number of items — Bob XOR Carol XOR Ted XOR Alice, for instance — and in the general case, XOR is true when an odd number of things are true.

So XOR isn’t totally stingy, but you might not like the results. You can have any one of coffee, tea or milk — or you can have all three mixed together, because three is an odd number. Wake up and smell that in the morning, I dare you.

Outside of pure math operations, XOR has some interesting practical uses. It’s used when generating random numbers to ensure that “random” really is random. XOR is also used in cryptography, sometimes alone as a simple “XOR cipher”, but usually as part of a more complicated system.

And there’s something called an “XOR swap algorithm”, which I don’t actually understand at all, but I assume has something to do with Bob caking Alice’s pie while Carol milks Ted’s coffee. Or something.

The important thing is, there’s “or” and then there’s XOR. So if you’re offering someone a choice and feeling particularly stingy, Scroogy or Highlander-y, remember the “exclusive or” that the math and logic types use. Because “or” is fine — but XOR is delicious.

Actual Science:
University of Maryland CSThe magic of XOR
MalwarebytesNowhere to hide: three methods of XOR obfuscation
Logic.lyXOR gate
CCSIThe XOR problem and solution

Image sources: PSU / Teaching with Databases (XOR Venn), Flying Monkey Philly (pumpple cake, which is somehow actually a thing), The Daily Banter (shiny happy Kurgan), 429 (B, C, T, A)

· Write a comment
· Tags: , , , , , ,


· Categories: Mathematics
What I’ve Learned:

The birthday problem: because nobody wants (or gets) to celebrate alone.
“The birthday problem: because nobody wants (or gets) to celebrate alone.”

Birthdays often have problems. Whether it’s the annual reminder of impending mortality, Grandma getting you the totally the wrong Teenage Mutant Ninja Turtle action figure or Marilyn Monroe failing to jump out of your cake to wish you happy birthday.

(Actually, regarding that last one, it would create a whole bunch of additional problems if she did. So stop wishing for that.

There’s always Marilyn Manson, if you just can’t shake the idea. Good luck with that.)

None of these issues is the birthday problem, however. The specifically-named “birthday problem” is actually a mathematical exercise — two words which you probably wouldn’t want to hear, in any combination, on your actual birthday. Assuming it’s not your actual birthday right now, here’s what the mathematical exercise asks:

Among a group of randomly-chosen individuals, what is the probability that at least two of them will share the same birthday?

The “randomly-chosen” bit is key, of course, since including certain individuals would muck up the math. The Olsen twins, for instance, would totally ruin everything.

(Presumably, this is not something you need mathematics to tell you.)

Assuming a full-on rand-o crowd, the question gets a little more interesting — to non-probability theorists, at least — when asked in this way:

How many people do you need to have a better than 50% chance of two people sharing a birthday?

That’s a trickier question than it looks. Most people can narrow down the range of possible answers a bit. If there’s one person in the room — scary Olsen or not — then there’s zero chance of sharing a birthday with the nobody else in attendance. And if (ignoring leap days, because ain’t nobody got time for that) 366 people are mingling, then the chance is 100% that at least two of them share a birthday. There’s only so much calendar to go around.

You might think that the number to get 50%, then, would be right in the middle. You would be mistaken.

Then again, a few minutes ago you wanted Marilyn Manson to hop out of a cake and sing to you. You don’t exactly have a track record for making good decisions.

The real answer (spoiler alert!) to this version of the birthday problem is 23. According to combinatorics probability theory — and some nifty math — with just 23 people in a room, the odds are slightly better than 50% that two of them share a birthday. If you want to increase the odds to 99.9%, you’ll have to make a few more phone calls — but your meeting hall still only needs a capacity of 70 people.

That’s nothing. They get bigger crowds than that at the Pawnee, Indiana town hall. And Ron Swanson doesn’t share his birthday with anyone.

This surprising result to the birthday problem is important for three reasons. First, maybe it instills in some young minds a wonder and love for math, and they’ll go on to become professional mathematicians. Which is great, because somebody has to take that bullet. And numbers make my head hurt.

Second, there are computer hacking strategies — called “birthday attacks” — that take advantage of the math behind the birthday problem to wreak certain kinds of digital havoc. These brute-force cryptographic manipulations are often aimed at using hash collisions to the hackers’ advantage. In other words, no birthday cake for you.

And finally, this demonstrates that there’s a big difference in calculating a 50/50 that any two people will share a birthday, versus the same odds that somebody in a crowd shares your birthday. For the latter, you’d need at least 253 people, which reminds us that probability is tricky, the obvious answer is not always the right one, and for crissakes stop making everything about you, ya town hall-cramming Olsen-loving Manson-caker.

And oh, yeah: happy birthday. Freak.

Actual Science:
Damn InterestingThe birthday paradox
Better ExplainedUnderstanding the birthday paradox
NPR / Math GuyThe birthday problem
Hack This SiteHash collisions and the birthday attack
University of WaterlooInvasive species use landmarking to find love in a hopeless place

Image sources: Math.info (birthday match graph), Photobucket / taintedXarts (birthday Manson), The Gloss (Olsen twin powers, irritate!), FanShare (in Spanish!) (Pawnee powwow)

· Write a comment
· Tags: , , , , , , , , , , ,


· Categories: Mathematics
What I’ve Learned:

Transcendental numbers: weird stuff happens when pi and yoga get together.
“Transcendental numbers: weird stuff happens when pi and yoga get together.”

I’ve heard mathematicians say that learning math is like peeling an onion. I assume what they mean is that there are outer layers built on more basic ones, with patterns and fundamentals that go all the way to the core.

But all I get out of it is that math will probably make you cry. And if you eat too much of it, no one will want to kiss you.

Take transcendental numbers, for instance. Those might sound like numbers that have turned on, tuned in and dropped out of the number line — possibly to hand out flowers at a local airport — but that’s not exactly true. Technically speaking, transcendental numbers are numbers that aren’t “algebraic”.

(In other words, numbers that have nothing to do with algebra. Lucky bastards. I tried that in junior high school, and they made me repeat a grade.)

Specifically, algebraic numbers are those you can plug into an equation with plain old integers or fractions, and make the result come out to zero. Or, for the protractor-and-pocket-protector crowd, numbers that are roots of finite, non-zero polynomials in one variable with rational coefficients. And gesundheit.

So 4 is algebraic, then, because if you take the equation “3x – 12 = 0” and plug in 4 for “x”, it all works and you get that zero out the other end, like you wanted. Of course, “4” works for a bunch of other equations, as does “9” and “42” and “1/17” and “2,641,835”.

All the everyday plain old numbers we know are algebraic as hell (not an official mathematical term), but it only takes one solvable equation (outside of multiplying by zero to get zero, you sneaky devil, you) to make a number algebraic. It’s easy. What self-respecting numerical concept wouldn’t bother to be algebraic? I ask you.

Well, for three-point-one-four-one-five-nine things, pi.

Pi is weird in a bunch of ways. But one of its oddball properties is that you can’t plug it into any equation containing only integers or fractions (aka, “rational numbers”) and make the thing equal zero. It can’t be done. Smart people have tried, with computers and abacii and everything, and it’s not happening. Pi r stubborn.

That also makes pi a transcendental number. But lest you think it’s some kind of lone wolf — a rogue bad boy who won’t play nice with the other numerical kids — get this: the set of transcendental numbers is, mathematically speaking, uncountably infinite. And if that doesn’t make your Euler shrivel up inside you, then you probably don’t want to hear that we don’t even know which numbers are which.

Oh, some numbers are safe. The rational numbers are all algebraic. But lots of irrational numbers — which, like pi, can’t be written as a ratio of two integers — might be transcendental. Nobody knows. Is there some weirdo pretzeled-up equation that a particular irrational number might fit, making it algebraic?

(Sometimes. Take the square root of 2. It’s not rational; can’t be written as a ratio of two integers. But it nestles nicely into the equation x2 – 2 = 0, so it is algebraic.

But that’s an easy one. Numbers are like Tinder dates — the irrational ones aren’t usually nearly so accommodating.)

A few other (totally irrational) numbers have been outed as transcendental. Like “e”, the base of the natural logarithm. Esoteric weirdos like the Gelfond-Schneider constant, the Fredholm number and the Liouville constant (which really got the transcendental Bingo ball rolling back in the mid-1800s).

But most irrational numbers — which can be “real” like pi, or “complex” (which is to say, half-imaginary) like 2 + 3i, where “i” is the imaginary unit equal to the square root of -1, which isn’t a thing that exists in the actual world of onions and shriveled Eulers and unkissable mathematicians — might be algebraic, or they might be transcendental numbers. Like, is ee transcendental, or just weird as hell? What about pi – e, or pi/e? Today, no one can say. Maybe someday, smart math people will figure out some way to tell for large swaths of these bizarro half-made-up numbers of theirs.

In the meantime, I’ll be huddled over here in the corner. Crying on my onion slices and watching out for irrational transcendental numbers. And I thought eighth-grade algebra was scary.

Actual Science:
Good Math, Bad MathIrrational and transcendental numbers
Math LairTranscendental numbers
University of Wisconsin / Cliff PickoverThe 15 most famous transcendental numbers
GizmodoWhat the hell is a transcendental number?

Image sources: Mind Your Decisions (transcendental pi love), MNN (onion cryer), MemeGenerator (totally rational date), Brown Sharpie (tie-dye pi [and also e])

· 1 comment
· Tags: , , , , , , , ,


· Categories: Mathematics
What I’ve Learned:

Statistical significance: 'Do you feel 95% confident, punk?'
“Statistical significance: ‘Do you feel 95% confident, punk?'”

People are scared of numbers. Sometimes, the fear is justified. A 330 on your credit score report, for instance, is genuinely horrifying. So is a 410 on your SAT. Or anything greater than “two”, when asked how many cats your mother owns.

But most numbers are harmless. People only fear them because they might wind up in a statistic, and everyone is afraid of statistics. The saying is not “lies, damned lies and sharks with frickin’ laser beams”. It’s statistics. Even scarier than laser-sharks.

The problem is understanding. I can help — though only to a degree, because mathematics are involved, and I swore after memorizing the Pythagorean theorem that I was “full”, and couldn’t learn any more math.

(Which is probably why I’m familiar with the horror of subpar credit scores. And low SATs.

Someday, this will probably drive my mother to adopt a dozen cats. But not yet. Whiskers crossed.)

Happily, you don’t need math to demystify statistics; you only need to know about statistical significance.

(Although you might need a calculator or a fancy-ciphering web page to do some maths for you. Stand on the shoulders of Poindexters, my friend.)

Statistics can be manipulated to say just about anything — like a willing stool pigeon, or a guy trying to get a date with a lingerie model. The question is how confidently those stats say something, and that’s where statistical significance comes in.

Most scientists will run with a conclusion if they believe it’s at least 95% likely to be true. Some tests require 99%, and a few really crucial questions — like, can we clone Neil DeGrasse Tyson’s mustache in time for Halloween — need a 99.99% (or greater) probability before they’re accepted.

So how do researchers achieve those levels of confidence? Flip a thousand coins and see what comes up? Ask a Magic 8-Ball which answer is better? Co-author their papers with a pigskin-prognosticating porcupine?

(Based on recent scientific scandals, yes. A few of them apparently do.

But we try to weed these idiots out, based on their SAT scores. Or how many cats their mothers own.)

Real scientists determine statistical significance by performing calculations that take important factors into account, like the number of observations and the likelihood of the results.

For example, the “p-value” calculation, which involves math with Greek letters and squiggly brackets and other head-exploding details. But just remember it like this: the “p” in p-value stands for “pssshaw“, as in: “Pssshaw, you’re wrong; I bet your mom owns so many cats.

Once calculated, the p-value is the probability (subtracted from 1) that your scientific conclusion is full of smoking cat turds. A 1.0 means you’re one hundred percent talking out your ass, and a value of 0.05 means you can be 95% sure you’re not vocalizing through your rectum.

The keys to getting low — meaning good — p-values are making a lot of observations, and having most of those come out one way, and not the other. A million dice rolls where every number comes up just as often doesn’t tell you anything about what’s coming up next. And — to the chagrin of sportscasters everywhere — a winning (or losing) streak of one, two or eight games isn’t sufficient to make their pre-game blather “significant”. Or coherent, if there’s a liquor cabinet in the press box.

Another example: over the years, I’ve worked with a number of Belgians. From my observations, 100% of Belgians are named Paul, 100% wear fashionable sweaters, and 50% say really inappropriate things in the workplace.

Those are statistics, based on real observations — and some very uncomfortable staff meetings. But do the conclusions have any statistical significance? If the number of observations is ten million, sure. If the number is two (which it is), then no, more observations are needed. You should take these stats, and all others with low (or ambiguous) statistical significance, with a healthy grain of salt.

Also, a huge pile of kitty litter. But preferably not from your mom.

Image sources: ScienceNews (p-value roller coaster), Discovery/TLC (cat-wrangling mama), Daily Caller (“Watch out, guys; we’re dealing with a badass ‘stache over here.”), The Awl (8-ball uncertainty)

· Write a comment
· Tags: , , , , , , , , ,