In second year, after the whole business with the basilisk, the Golden Trio are discussing their plans for next year. Hermione mentions taking Arithmancy so she can learn to make spells, and Harry decides to make a spell of his own on the spot. He really regrets that it works.