Another way to say "a hat is used for keeping your head warm" is "one way to keep your head warm is with a hat."