How to prevent cheating on take-home exams
One way to do it: if the assignment has many small questions, you can make it more difficult taking a random draw from a bigger pool for each student, so they are all slightly different. So, any pair of students would have just a portion of them in common. This can appear unfair, but it should even out if you do it many times.
But, if this were a fight, you would be on the losing side; for any strategy you can come up with, someone else would find the way to hack it. You should instead focus on making people not want to cheat.
- Make the problems interesting challenges, not mechanical tasks. If it involves some creative thinking it is less likely that two students arrive independently to the same solution (and even less to arrive to the same solutions in each exercise).
- But make them approachable. If they look impossible, it is more tempting to cheat. In a course I took recently, we had to solve an easier version of a problem, and apply it to a more difficult one. We only had to hand in the difficult version, but handing in only the easy part gave also points.
For what I have seen from a student perspective, the more advanced the course, the less likely cheating is, and the more frowned upon by the other students is.
The solution I've observed at my Alma Mater: Take-home exams are given only with very few questions, which are non-trivial and open-ended. Now, if several students work together on this exam, but every one of them manages to come up with an answer which doesn't read like a copy of the other students' answers - then, well, that means they have some sort of command of the material, even if they didn't come up with the idea themselves.
Of course, this is mostly relevant for more advanced courses. In more basic courses, there are never any home exams.
Don't, maybe? They can't cheat if collaboration isn't against the rules.
Do you care what the students know, or do you care how they learn it?
Why not consider setting it as a coursework assignment, and taking away the restriction entirely? You open the door to them being able to collaborate, work together, come up with creative solutions. Tell them to declare who they worked with in a short section at the top.
Education has this strange focus on separating people: when was the last time you did an assignment, research project or similar truly alone? In the professional world I've never once done a truly solo project: finding solutions as part of a team is a vital skill, and this sounds like a perfect opportunity to encourage it.
Grading is important, of course, and there is a time for differentiating between students... that time is in the formal, controlled examinations. Everything else is a learning exercise, and if they learn it by working with a friend, fantastic.