self-contradictory recursive problem

"Let the barber of Seville shave every man of Seville who does not shave himself.
Who shall shave the barber?"

So my book says that this is self-contradictory. but how?

From my reading of it, it's just that the barber of Seville shaves every man in Seville who doesn't shave themselves. Well the barber doesn't have to shave himself (or he could shave himself). So then someone else can shave the barber along with every man of Seville (and those who do not shave themselves can be shaved twice...)

Who shaves him? If he shaves himself that is impossible for he shaves everyone who does not shave himself. If he does not shave himself then he has to shave himself because he shaves everyone who does not shave himself.

"Let the barber of Seville shave every man of Seville who does not shave himself.
Who shall shave the barber?"

So my book says that this is self-contradictory. but how?

From my reading of it, it's just that the barber of Seville shaves every man in Seville who doesn't shave themselves. Well the barber doesn't have to shave himself (or he could shave himself). So then someone else can shave the barber along with every man of Seville (and those who do not shave themselves can be shaved twice...)

Another possibility is that nobody shaves the barber because she doesn't grow a beard.

This question ilustrates the difference between mathematics and real life. A mathematical model of a real-life problem often contains many unstated assumptions. In this case, it is assumed that the men of Seville form a precisely identified set which contains the barber and on which the relation "shaves" is a function. That is to say, each man in the set is shaved by exactly one man in the set.

Self-referential statements can lead to all kinds of fun paradoxes. Whether or not a statement is actually paradoxical and how one can resolve the paradox is a topic of much discussion in philosophy and mathematics. Your problem is an example of Russel's Paradox: Does the set of all those sets that do not contain themselves contain itself?

One of my favorites is: "The smallest integer not definable in fewer than twelve English words." This takes a bit of thought to see why it is a paradox.

Your problem is an example of Russel's Paradox: Does the set of all those sets that do not contain themselves contain itself?

But it is not really a paradox in math. The point of this paradox is to show that the set of all sets cannot exist. Suppose that is the set of all sets then by the Axiom Schema of Compresension that set will exist. But this set will lead to a contradiction. Thus, the set of all sets cannot exist.