Public key cryptography question - Is Private or Public key used to sign? Confusion between which key is used to sign and which is used to encrypt I am relatively new to cryptography and blockchain and am learning about how public key cryptography works, and its application in Bitcoin's environment.

I read two different articles , the 1st which made sense, but the 2nd confused me. 

From the 1st article (https://www.blockchain-council.org/blockchain/how-does-blockchain-use-public-key-cryptography/), I understand that the sender's private key is used to sign the digital transaction and the sender's public key is used by the miner/receiver to verify the senders signature. 

However,a 2nd article I read (https://www.ibm.com/support/knowledgecenter/en/SSB23S_1.1.0.14/gtps7/s7pkey.html) about public key cryptography has it the other way around; using Public key first then the private key after. I have attached the picture from the 2nd link:



What am I understanding wrongly? Why is the use of keys in opposite order?

Thank you in advance for your input...
What am I understanding wrongly?

You are mixing up several distinct uses of cryptography, several different purposes:

authentication
non-repudiation
privacy
proof of integrity

Cryptography in General
Purposes
Privacy
If you want to send a private message to someone, in a way that no-one intercepting the message can read it, you typically encrypt the message using a symmetric (secret-key) algorithm and a newly created secret-key. You then encrypt the secret-key using the intended recipient's public key. This ensures that only the intended recipient can decrypt the secret-key for the message by using their private key (which no one else knows). After decrypting the secret key, the intended recipient is able to decrypt the message using the symmetric algorithm.
Note that you only use a symmetric algorithm to encrypt the message because such algorithms are far far faster than asymmetric (public-key) algorithms. It is primarily for efficiency, not for any other reason.
Authentication
If you want to send a message to someone and provide proof that you sent the message, you use a different procedure. You create a cryptographic hash of the message using a hashing algorithm. You then encrypt that hash with your private key (that only you know). The encrypted hash is sent with the message. This encrypted hash is known as a digital-signature. The recipient of the message can use your public key to extract the hash and compare that with a freshly computed hash of the message, if the hashes match it is proof that you sent the message.
Types of Encryption
Assymetric
Asymmertic means you use different keys for encrypting and decrypting. There is both a private key and a public key. hence the name &quot;public-key cryptography&quot;.
Symmetric
By contrast, an example of a symmetric (not asymmetric) algorithm is DES which is a symmetric encryption algorithm because there is only one key, the same key is used for both encrypting and decrypting. The key is a shared &quot;secret-key&quot; - hence the names &quot;secret-key cryptography&quot; or &quot;shared-key cryptography&quot;.

Cryptography in Bitcoin
From what I've read, Bitcoin uses

Hash algorithms

SHA-256 for proof of work


Digital signatures

ECDSA for signatures on transactions



Note that ECDSA is asymmetric
Note also that Bitcoin cares about anonymity and not about privacy (the blockchain is public not private). Therefore Bitcoin does not use encryption for privacy purposes. Your Wallet software might use encryption to hide your secret keys behind a password - but that is not part of the BitCoin spec.

References

Satoshi Nakamoto, Bitcoin Whitepaper. Sections 2 and 4.
Bitcoin Wiki, ECDSA