I'm working my way through A Book of Abstract Algebra by Charles Pinter. I ran into a snag on page 54. This is problem C5:
"Let G be a finite group and let S be a nonempty subset of G. Suppose S is closed with respect to multiplications. Prove that S is a subgroup of . (Hint: it remains to prove that S contains e and is closed with respect to inverses. Let S={a1,…an}. If ai∈S, consider the distinct elements aia1,aia2,…aian.)"
OK ... I did figure out part of it. If I imagine a Cayley Table for S, the set of elements aia1,aia2,…aian will be a row in it. That row will be a selection from the corresponding row of the Cayley Table for G. No row in the Cayley Table for G has any duplicates, so no selection from it can have any duplicates either. If S is closed under multiplication, then ai∈S, then ai must appear in that row somewhere. For some k, ai=aiak and then e=ak.
Or does it? Actually, I don't think so. I think that last step fails.
Here's a sample Cayley Table, not a group, but a binary structure on the set {a,b,c}:

Every element appears in every row and column, nothing appears in any cell that isn't an element of the set, but there's no identity.
Either I disproved what Dr. PInter wants me to prove, or I made a mistake. Can anybody show me where I went wrong?
Thanks in advance.
"Let G be a finite group and let S be a nonempty subset of G. Suppose S is closed with respect to multiplications. Prove that S is a subgroup of . (Hint: it remains to prove that S contains e and is closed with respect to inverses. Let S={a1,…an}. If ai∈S, consider the distinct elements aia1,aia2,…aian.)"
OK ... I did figure out part of it. If I imagine a Cayley Table for S, the set of elements aia1,aia2,…aian will be a row in it. That row will be a selection from the corresponding row of the Cayley Table for G. No row in the Cayley Table for G has any duplicates, so no selection from it can have any duplicates either. If S is closed under multiplication, then ai∈S, then ai must appear in that row somewhere. For some k, ai=aiak and then e=ak.
Or does it? Actually, I don't think so. I think that last step fails.
Here's a sample Cayley Table, not a group, but a binary structure on the set {a,b,c}:

Every element appears in every row and column, nothing appears in any cell that isn't an element of the set, but there's no identity.
Either I disproved what Dr. PInter wants me to prove, or I made a mistake. Can anybody show me where I went wrong?
Thanks in advance.