Q: gerunds: difference between "on doing", "by doing", and "in doing"? What is the difference between "on doing", "by doing", and "in doing"?
A difficult point to French learners of English as in all three cases, you would say "en faisant".
Example sentences, taken from the Longman Dictionary of Contemporary English:
What was your reaction on seeing him?
Howard had put his own life in danger in trying to protect the Queen.
She earns her living by selling insurance.

A: The difference between "on leaving" on the one hand and "by selling" and "in trying" on the other hand is easy: "on leaving" is to do with time and means "when you saw him", whereas "by selling" and "in trying" are to do with the cause and effect relationship.
But there is a difference: by = she sells insurance in order to earn a living, it is her aim, it is a means to an end; in = Howard does not try to protect the Queen in order to put his own life in danger, it is just an occupational hazard for bodyguards, a side effect.
