By recommending some book you implicitly acknowledge all of its contents (unless specified otherwise). In fact it would be similar if the student used a solution you presented, which happens to be wrong, but you only discovered the flaw when grading the exam. What would you do?
First, I would not penalize the student for copying the solution from the book, actually I would deal with it as if the student happen to write exactly the same solution by himself/herself. The reason is that the modern math is built upon previous results and reinventing the wheel is not a good strategy.
Then, there are three solutions I would consider:
- Give full credit. The solution might be wrong, but you don't expect the students to recognize the difficulty (perhaps even the teacher missed it at first). One can give bonus points to those who did.
- Give partial credit. The fact that some respectable author got it wrong is some indication that it might be a "reasonable mistake", that is, the approach could be mostly correct but for some subtlety that is non-intuitive and hard to spot. Partial credit is always tricky, though.
- Grade it like everything else (perhaps no credit). Wrong solution is not a valid solution independent of where it comes from. If the students think the solution is good enough to copy it, they are wrong and should be graded accordingly.
My preferred one is the third: in math the meaning of authority is slightly different than in other areas and students should understand that nobody is exempt from following only valid inferences. On the other hand, it would be weird to enforce this rule unless you told the students about it.
Partial credit is the most common solution from my experience. Many professors grade not only what was written down, but also what kind of understanding the work implies. The solution might be incorrect, but the intuition behind it might be still valid. However, it is inherently hard to grade understanding and what is obvious from one perspective might be difficult from another point of view. The fact that the book's author got it wrong suggests that there is some other intuition that works just as good as yours (e.g. the rest of the book is great), but handles this particular case badly. Therefore, it could still seem like an obvious mistake to me, but I might opt to give some more points nevertheless.
Rarely, but it happens, you may want to give full credit. I don't like it, but I see why someone might want to use this solution. One case is when you don't want to bother students with subtleties, for example
- in some engineer classes, where theory is secondary at best, you could accept solutions that miss the fact that some matrix could be singular in a problem where a random distortion of input data fixes the problem;
- in a discrete math course, some series-related theorems work only with proper convergence arguments, however, appropriate techniques/formalizations might be too hard or not that important (e.g. the topic wasn't covered in depth); a correct, formal solution would be to guess the result using the incorrect derivation, and then proceed by induction (or whatever), but some deem such a level of scrutiny unnecessary.
Another case is when the problem set wasn't tested enough. There was an exam once in my student times where the lecturers did a mistake about what works and what does not. In result, one task came out much, much harder than it was meant to be. Most students missed the subtlety (i.e. used the same solution that the lecturers thought it worked), others did notice and presented a counterexample. There was an announcement and both types were accepted with a perfect score.
I hope this helps $\ddot\smile$