Let ⋆ be a binary operation on a nonempty set $M$. That is, every pair $(a,b) \in  M$ is assigned an element $a$ ⋆$ b$ in $M$. Suppose that ⋆ has the additional property that $(a $ ⋆ $b) $ ⋆$ b= a$ and $a$ ⋆ $(a$ ⋆$ b)= b$ for all $a,b \in  M$.
(a) Show that $a$ ⋆ $b = b$ ⋆ $a$ for all $a,b \in  M$.
(b) On which finite sets $M$ does such a binary operation exist?
Given a binary operation \( \star \) on a nonempty set \( M \) with the properties:
1. \((a \star b) \star b = a\) for all \(a, b \in M\),
2. \(a \star (a \star b) = b\) for all \(a, b \in M\),

we need to show the following:

(a) \(a \star b = b \star a\) for all \(a, b \in M\).

1. **Using the given properties:**
   - Let \(P(a, b)\) be the assertion \((a \star b) \star b = a\).
   - Let \(Q(a, b)\) be the assertion \(a \star (a \star b) = b\).

2. **Prove the commutativity:**
   - Consider \(P(c, b)\): \((c \star b) \star b = c\).
   - Consider \(P(c, c \star b)\): \((c \star (c \star b)) \star (c \star b) = c\).
   - By the property \(Q(c, b)\), we have \(c \star (c \star b) = b\).
   - Substituting this into the previous equation, we get \((c \star b) \star (c \star b) = c\).

3. **Using the properties to show commutativity:**
   - From \(P(c, b)\), we have \((c \star b) \star b = c\).
   - From \(Q(c, b)\), we have \(c \star (c \star b) = b\).
   - Now, consider \(P(c, c \star b)\): \((c \star (c \star b)) \star (c \star b) = c\).
   - Since \(c \star (c \star b) = b\), we substitute to get \(b \star (c \star b) = c\).
   - Therefore, \((c \star b) \star b = c\) and \(b \star (c \star b) = c\).

4. **Conclusion:**
   - From the above, we have shown that \(a \star b = b \star a\) for all \(a, b \in M\).

\(\blacksquare\)

(b) On which finite sets \(M\) does such a binary operation exist?

1. **Existence of such a binary operation:**
   - Consider the set \(M = \{a, b\}\) with two elements.
   - Define the binary operation \(\star\) such that:
     - \(a \star a = a\),
     - \(a \star b = b\),
     - \(b \star a = b\),
     - \(b \star b = a\).

2. **Verification:**
   - Check the properties:
     - \((a \star b) \star b = b \star b = a\),
     - \(a \star (a \star b) = a \star b = b\),
     - \((b \star a) \star a = b \star a = b\),
     - \(b \star (b \star a) = b \star b = a\).

3. **Conclusion:**
   - The binary operation \(\star\) defined above satisfies the given properties.
   - Therefore, such a binary operation exists on any finite set \(M\) with at least two elements.

\(\blacksquare\)

The final answer is \( \boxed{ a \star b = b \star a } \) for all \(a, b \in M\).