The 'if' clause can precede or follow the main clause:

If two events are independent, we multiply the probabilities.

We multiply the probabilities if the two events are independent.

However, 'only' behaves like a negative word. When it occurs at the beginning of a sentence, it causes the subject and auxiliary to be inverted:

If two events are independent, **we** __can__ multiply the probabilities.

Only if two events are independent __can__ **we** multiply the probabilities.

If two events are independent, we multiply the probabilities.

Only if two events are independent __do__ we multiply the probabilities. [there wasn't an auxiliary to invert, so we have to add auxiliary 'do']