Cryptography is the study of how to convert messages into code (encryption) and how to solve codes (decryption). Just as TCP enables reliable transmission over an unreliable network, cryptography enables verifiable, secure transmission over an insecure network.
Symmetric cryptography, uses the same secret key to encode and to decode a message. Symmetric cryptography has been around for thousands of years. The trouble with symmetric cryptography is: how can we keep the key secret?
Public key (asymmetric) cryptography was created by mathematicians in the 1970s. It uses two different keys for encryption and decryption, so sharing the public encryption key doesn't give away the private decryption key.
Secure HTTP connections (those that use https:// instead of http://) use a protocol called Transport Layer Security (TLS) or maybe an older version called Secure Sockets Layer (SSL). Both are based on public key cryptography. With SSL/TLS, the site you are visiting sends its public key, and your browser uses it to encrypt the information you send. The end of this video you've seen before describes these protocols.
In order to work properly, a cryptographic function has to be easy for the private key holder to invert, but hard for anyone else to invert. How do we know what "hard" means? For example, current cryptographic methods rely on the difficulty of finding prime factors of very large numbers. There's no proof that someone won't come up with a fast way to do that, but people are pretty confident about it because the problem has been well studied by many mathematicians. (On the other hand, when quantum computers become practical, factorization will be easy, and new cryptographic methods will be needed.)
What makes it possible for mathematicians to study the difficulty of breaking Internet cryptography is that the method used—the cryptographic function—is openly published. This may seem strange; if you want to keep secrets, shouldn't you keep the technique secret, too? But secret algorithms can have weaknesses that go undiscovered until some bad guy exploits them. Open standards allow an algorithm to be studied before it is used in practice.
Public key cryptography doesn't solve all the problems, because someone might publish a fake public key pretending to be someone (say, Alice). Then someone might accidentally encrypt their message for Alice using the faker's key, and then the faker can read the message. In practice, this is partly fixed by relying on trusted third parties, called Certificate Authorities, to issue public keys. In your browser's security options you can see all of the Certificate Authorities that it trusts.