Monday, May 18, 2009

Error Correcting Codes

First, I have six treatments to go; 12 in total.

Since I'm just laying in bed right now with nothing else to do I will do my best to explain what an error correcting code is. There is a decent Wikipedia article on Forward Error Correction, which is a place where ECC find their application. You would be amazed how many things in your life utilize ECC (hard drives in computers, portable flash/thumb drives, CDs, DVDs, everything you do on the Internet, etc.). It is an aspect of communications systems. Basically, in a communication system, you can never really be sure that the person you're talking to heard you right... and if you're listening, you can't be sure that what you heard was right.

Human speech is a sort of example of a communication system but it's hard to use as a good example because it is highly redundant to begin with (you don't really need to hear all of what someone says to know what they're talking about). And our brains are exceptional computers and we have a hard time abstracting the process of discerning what it is that someone said. So to use speech in my next example, I will contrive an example that doesn't use English words.

Imagine that there are two people in a crowded food court at a mall and they are separated by some distance. One of them knows the winning lottery numbers and needs to tell the other so he can buy a ticket. You really want to be pretty certain you heard the numbers right. One option is to have the sender scream loudly (which in actual terms means increasing the power of the transmission). Say he's got a sore throat though so he can only get so loud (which is analagous to the very real scenario of something like a cell phone, where it can only be so powerful given that it's a handheld device running on a small battery). You can hear him but not great. Another option is to have him repeat each number twice. If you hear two different numbers, you know there's been a mistake. You don't which number is correct though. You can yell back and ask him to repeat it (which is a form of communications protocol, known as a negative acknowledgement or NACK). But that takes time to do, and maybe you've lost your voice or something so you can't do it to begin with (a simplex or one-way communications channel). The sender could say each number three times, and you could take a majority vote of the three copies you received. This way you can detect and correct one error. (actually the "detection" part might be more, but it's complicated because my example isn't bits, it's words).

The fact that you send the "data" three times and take a majority vote at the receiver is a rudimentary and highly suboptimal example of an error correcting code. There are many thousands of pages that have been written about the various clever ways one can mathematically encode data such that errors can be detected and in some cases corrected in a communication system. Pretty much all modern forms of communication would fall apart without error correcting codes. So they're pretty interesting and useful.

Forward error correction is a way of preemptively putting information in that will enable the receiver to detect and possibly correct errors. If you can't detect that an error has likely occurred, you wouldn't know to ask for that piece of information again. And if you can correct it without any intervention from the sender, you don't have to go through the process of asking for the piece again and verifying it was correct. There are many applications where the penalty for asking for information again is great and you would really prefer that it all just get there right the first time.

A good real life example of this is geosynchronous satellites. That is, satellites whose orbit matches that of the earth (they are always appear to be over the same spot on the earth, not orbiting around it since they have an orbit that matches that of the earth). The physics of it means that all such satellites are about 22,200 miles above the earth. If you are trying to communicate over a satellite channel, the speed of light becomes annoying. The fastest you can possibly hope to get data to the satellite is about 0.12 seconds (thanks to the speed of light). Now the satellite has to beam it back down to earth as presumably you are not talking to an astronaut on said satellite. That takes another 0.12 seconds. So to send anything, it takes 0.24 seconds for the receiver to receive it. So you say "Hi", it takes him 0.3 seconds to receive it. He says "Hey there to you too", and it takes another 0.24 seconds for the "Hey" to make it back to you. You can imagine it is very annoying to have a 0.5 second delay in your conversation. It will be very awkward and you'll be asking each other to repeat things and stopping in the middle because you realize you're both talking at the same time. It's even worse when you're dealing with digital data. If you send one letter at a time, and the receiver can't correct an error, he has to ask for a retransmit, meaning it will take 0.72 seconds just to get the second copy (0.24 to send/receive the letter, 0.24 for the receiver to transmit a NACK and for the transmitter to receive said NACK, 0.24 for the sender to send the letter again). You can see that the penalty for failure adds up quick. You want it right the first time.

5 comments:

  1. MAAAAAN, that was a mouth full, but I actually can relate to what you are talking about.
    I first heard of "Error Correction Codes" back in my days of those submarines where we used Cryptography. We used to have those midwatch deep conversations with the Radioman (nothing else to talk about after a couple of months under water.
    Basically wireless channels are prone to all kinds of transmission errors, but more importantly in the world of Crypto, it is prone to data security. As our technology advanced, so did the choices of error correcting codes (basically better and more secure Crypto capabilities).
    Those same radioman would also start to through out theories about "Boolean Functions", which I thought was pure bull until I later found out they do play a role in the Cryptographic and error correcting coding, but I'll be dammed if I can actually understand it.
    So all in all I can relate to your statement that most all of our modern forms of communication would fall apart if not for the use of error correcting codes (they are useful little buggers). You missed your calling. Should work towards being a professor. You could probably teach this stuff.
    We missed some of your last blogs. Went to Savannah GA. for some quality time together and to celebrate our 29th anniversary.
    Nice historic town (with all the ghosts included), but a bit expensive.
    Hope all else is going well with the both of you. Take care.

    Uncle John

    ReplyDelete
  2. Dear Ryan,

    Thanks for the codes course synopsis. I actually understood it. John's right. You would make a great professor.

    I'm sorry about confusing the number of treatments remaining. I guess it was wishful thinking. You even have 6/12 in one of your blog titles.

    Since I seem to be numerically challenged, I want to make sure I have the dates right for visiting you. Holly and I are looking at coming on the evening of July 9th and leaving the morning of July 13th? Is that the correct weekend?

    Love,
    Mom

    ReplyDelete
  3. Ryan, you really would be good at teaching this kind of 'stuff' to others. Your presentation was easy to follow. When I recall my early years of listening to musical lyrics, I completely opted out of listening to the words cause I always got them wrong. But later when I dechiphered how I really was listening it became clear that it was through my emotional brain. That's probably what you meant when you said you don't need to hear everything because our brains (including our emotional brain) are exceptional computers.

    Last time I tried to post (I had some down time) the electricity blacked out and I lost it. This morning will be the last of my busy school year and I'll get to communicate more with you guys on this blog. But I've been reading and enjoying what you post. Thank you so much for having us a part of your life's adventure.

    Okay ... gotta go put on the last talent show with the kiddies. They're so cute this year!!!

    Love, Laurie

    ReplyDelete
  4. Hey Ryan,
    Well..........this is definelty something I've NEVER thought about, but I suppose "someone" has too!!!! Thanks for the explanation....it does make sense.
    It's rain, rain, RAIN!!!!! I've had enough!
    So wonderful you are half-way thru' trx.
    I hope you and Emily have a GREAT long weekend!!!!
    Love and hugs to you both, Jill-Mom XXXXXXXXXXOOOOOOOOOOOOOOOOOOOO

    ReplyDelete
  5. You are such a quirk.......

    A freakishly brilliant quirk.

    That's all.

    ReplyDelete