These key pairs can be used in two different ways, to provide privacy or authentication. Privacy is ensured by encoding a message with the public key as it can only be decoded by the holder of the private key.
Authentication is achieved by encoding a message with the private key.
Once the recipient has successfully decrypted it with the public key they can be assured it was sent by the holder of the private key. One disadvantage of the public-key system is that it is relatively slow, so when it is being used only for authentication it is not desirable to encrypt the whole message particularly if it is a long one. To get round this a digital signature is used.