We use to… to say why somebody does something (= the purpose of an action):
* ‘Why did you go out?’ ‘To post a letter.’
* A friend of mine phoned to invite me to a party.
* We shouted to warn everybody of the danger.
We use to… to say why something exists or why somebody has/wants/needs something:
* This wall is to keep people out of the garden.
* The President has a team of bodyguards to protect him.
* I need a bottle opener to open this bottle.
We use to… to say what can be done or must be done with something:
* It’s difficult to find a place to park in the city centre. (= a place where you can park)
* Would you like something to eat?
* Have you got much work to do? (= work that you must do)
* I get lonely if there’s nobody to talk to.
Also: money/time/chance/opportunity/energy/courage etc. to (do something):
* They gave us some money to buy some food.
* Do you have much opportunity to practise your English?
* I need a few days to think about your proposal.
For… and to…
* I’m going to Spain for a holiday.
but I’m going to Spain to learn Spanish. (not ‘for learn Spanish’, not ‘for learning Spanish’)
We use for + noun (for a holiday) but to + verb (to learn). Some more examples:
* What would you like for dinner?
but What would you like to eat? (not ‘for eat’)
* Let’s go to the pool for a swim.
but Let’s go to the pool to have a swim.
Note that you can say… for (somebody) to (do something):
* There weren’t any chairs for us to sit on, so we had to sit on the floor.
You can use for ~ing to say what the general purpose of a thing is. To… is also possible:
* This knife is only for cutting bread. (or… to cut bread.)
You can use What… for? to ask about purpose:
* What is this switch for?
* What did you do that for?
Sometimes you have to use so that for purpose. We use so that (not to…):
i) when the purpose is negative (so that… won’t/wouldn’t):
* I hurried so that I wouldn’t be late. (= because I didn’t want to be late)
* Leave early so that you won’t (or don’t) miss the bus.
ii) with can and could (so that… can/could)
* She’s learning English so that she can study in Canada.
* We moved to London so that we could visit our friends more often.
iii) when one person does something so that another person does something else:
* I gave her my address so that she could contact me.
* He wore glasses and a false beard so that nobody would recognize him.