I am trying to get a handle on how stock trades actually go through practically. Let's assume a stock with only one buyer and one seller to make things easier to understand.
Scenario 1: Alice has an ASK price of $10.00 and Bob has a BID price of $9.00.
Scenario 2: Alice has an ASK price of $9.50 and Bob has a BID price of $9.50.
Scenario 3: Alice has an ASK price of $9.00 and Bob has a BID price of $10.00.
In scenario 1, the trade obviously doesn't happen, because they aren't compatible. The seller wants more than the buyer is willing to pay.
In scenario 2, the trade goes through because it's a match made in heaven.
In scenario 3, I am confused. I'd like to think the trade goes through, because why wouldn't it? But at what price does the trade happen? At the seller's price? Or the buyer's? Or does the stock get sold at the ASK price and bought at the BID price and the difference goes somewhere?
I wish to understand how scenario 3 works. And in general, I want to understand if I am thinking about this correctly. How do trades happen? How do buyers and sellers get matched with each other?