Lets say I have $10,000 cash in an account and margin buying power of $20,000. I sell a put that is worth $9,000 and it gets exercised. Will I be using margin since i have enough cash in the account to cover the $9,000? Sorry if this a noob question.
It really depends on who you broker with and how they operate. Consider that you probably use Robinhood, E-trade, or TD Ameritrade because you account value is not that high, I would venture out and say they would use your cash first.
Generally speaking, it is better for them to use up your cash first because it means that they don't have to waste their money loaning it to you when they could just use your money first. In the case of Robinhood, they will use up all your cash before going into your Gold (margin money).
Keep in mind though that you almost never would want to put your options on margin, especially when your margin is 2x your capital. If your options move against you in the short term, you risk them being closed out at a massive loss through something called a margin call which is where they liquidate your assets unless you put more money in the account because they think what you are doing is too risky and that you might end up not being able to pay them what they are owed.