Is it appropriate to say "hi" to a professor in email? There is a professor with whom I've taken two courses so far, and who has also agreed to write me a reference letter for graduate school when I complete my undergraduate program. I usually write to all professors "Dear Prof. [...]" or "Hello Prof. [...]", but some professors reply to me as "Hi [...]", which is OK. However, I'm wondering if it is also okay to reply "Hi Prof. [...]" in North America?
In this type of situation I always take the lead from the person I am writing to if they are more senior than me. This means that I start off the conversation using "Dear Professor X Y" and only switch to using "Hi X" once they do. 

I use the same rule of thumb for working out when to switch from using titles and surnames to first names. In most email communications I find this is normally after only one or two emails.

In other words, formality and respect are nice, but so is being friendly and saying hi.

Note: academic cultures do vary, and I am basing this on my experiences in the UK and EU. My impression is that in the USA there is a greater social distance between students and academics and therefore more formality is expected.