Learning to take good notes is very important. Good notes can help you remember and review a text you have read. There is no magic formula **to taking** notes when reading.You have to find out what works best for you. (Source: Iran's English Coursebooks)

I wonder why we have "taking" (a gerund) after "to". Is this "to" a preposition? I've checked a couple of dictionaries. The common combinations are:

(1) formula for: a formula for the withdrawal of US forces from the sea

(2) formula that: There is no magic formula that will transform sorrow into happiness.