Whereby and hereby, in particular, are very formal and rarely used in day to day speech or writing.
Whereby - by which
"a system whereby people could vote by telephone"
You use hereby when formally confirming what you are doing. I hereby sentence you for life after all the charges against you have been proven true.
Thereby means "by that means", or "as a result of that". The government increased spending on schools, thereby ensuring that all children could receive a good education.