From Longman dictionary I see that the word necessary can be used as follows:
It is necessary (for somebody) to do something.
Something is necessary for (doing) something.
However, I saw the sentence
Air is necessary to life;
in a book which I think should be
Air is necessary for life.
Which form is correct and why?