You are encouraged to work together on homework problems; working with others is one of the best ways to learn the material, and even if you understand it, it often helps you to understand it better if you try to explain it to others. If you work together on homework that is turned in, however, you must cite the other students who were involved, and make a brief explanation of the roles each student played in the process.
When you do work together, you should each write up your own solutions independently. That does not mean that you should both simply copy out the same thing; rather, it means that you can work together to develop ideas, but should organize and present those ideas independently. You should not work out every detail together; that is, when you have finished working with someone, there should still be some coordination left for you. If your papers look substantially the same at the end, you have worked together too closely.
To make this effective, I have the following rule about working with others: you may not take any written material away from a collaboration. You can write down all you want when you are together, but you must throw it all away before you separate. This will encourage you to rethink the material when you write it up. If the collaboration was successful (and you learned something from it), you should be able to reproduce those ideas on your own. If not, then you have not really learned from the collaboration, and should not receive credit for work that you don't actually understand well enough to describe independently.
You may not work together on exams or problem sets. This means you may not discuss the problems outside of class with anyone but the course instructor. That includes other members of the class, other students, other professors, your parents, your siblings, and your dog. I take this policy seriously, and so does the College. I interpret this to mean that if someone asks you "How is the problem set going?" your response should be "I'm sorry, I can't discuss the problem set until after it is turned in." Here "discussing" means any form of communication about the problems, including talking, looking at another student's written work, scratch work, or notes, looking at old copies of problem sets from previous years, or finding solutions on the internet. Be sure to read the cover sheet to remind you of the terms each time you begin a problem set.
The college takes plagiarism very seriously, and so do I. You should be sure to read the material on plagiarism and academic honesty that you received in your freshman orientation package.
Please read the comments on collaboration from my advice pages.