You can remember the meaning of 违反 with this easy mnemonic:
I accidentally violated the law. I disobeyed (违) the speed limit, and if I could reverse (反) time, I would slow down before the camera.
Using mnemonics to remember the meaning of Chinese characters like can have an enormous impact on how long to learn Mandarin it takes.