Do they have the same meaning? When is each one used?
By contrast / In contrast
I often use these two phrases in both writing task 1 and 2. They are exactly the same, and are used in a similar way to “however” or “on the other hand” to introduce a contrast / comparison. Put “By / In contrast” at the beginning of a sentence, with a comma after “contrast”.
Unemployment rose in the UK. By contrast, the number of unemployed people in Canada fell.
On the contrary
I don’t think you’ll need this phrase for any part of the IELTS test. It doesn’t mean the same thing as “by / in contrast”. We use “on the contrary” to deny that something is true, and to explain that the opposite is true.
– Person 1: “You had some problems with your hotel, didn’t you?”
– Person 2: “On the contrary, the hotel was great, but the airline lost my suitcase.”