Answers:
a. 21 handshakes
b. n(n-1)/2 handshakes
===========================================
Explanation for part (a)
There are 7 people to pick from. Whoever is chosen cannot be reselected, so we have 7-1 = 6 choices remaining for the second selection.
There are 7*6 = 42 permutations possible. Order doesn't matter in a handshake. Something like AB is the same as BA. Because of this we must divide by 2.
42/2 = 21 handshakes are possible among 7 people.
-----------------
Another approach for part (a)
Let's give the people code names A,B,C,D,E,F,G.
Person A has 6 choices to pick from to get a handshake.
Person B has 5 choices because person A is already accounted for.
Person C has 4 choices since A and B are already accounted for.
And so on. We have 6+5+4+3+2+1 = 21 different handshakes among the 7 people.
-----------------
Explanation for part (b)
n = number of people
n is a positive integer {1,2,3,4,...}
We have n choices for the first slot and n-1 for the second. That gives n(n-1) permutations and n(n-1)/2 combinations. We go with combinations because order doesn't matter.