So for a set S to be a group it must:

- be closed with respect to (check)

- associative (check)

- identity

- inverses

So you are given that both cancellation laws hold. I assume that you mean that left and right cancellations hold. First we need to show that there exists an identity because we need it for the inverses.

If the set is finite, we must have that for some

From associativity you have

and . So now is our identity.

So now that , we must have that

and , so we get that exists and is equal to . Thus the set is a group.

Now, we cannot use the same argument if the set is infinite. We need something else there. In the above argument we have only used the definitions of the identity and the inverses and we haven't used the cancellation laws yet.