
Justin R. answered 11/21/20
Ph.D. in Geophysics. Teaching at the university level since 1990.
First try: 1/7 = A
Second try (assuming you take the key tried in the first out of contention): (1 - A) * 1/6 = B
The (1 - A) term is the likelihood the your first try failed. The (1/6) terms comes from the fact that six unused keys remain and one will open the lock.
Third try: (1 - A - B) * 1/5 = C
Here we multiply the probability of getting past try 1 then try 2 before picking one of the 5 remaining keys.
Fourth try: (1 - A - B - C) * 1/4 = D
Fifth try: (1 - A - B - C - D) * 1/3 = E
Six try: (1 - A - B - C - D - E) * 1/2 = F
Last try: (1 - A - B - C - D - E - F) * 1 = G
In general, the probability of opening the lock with the nth key is equal to 1 over the number of unused keys times (1 - probability of success on any prior try).
If you check, you'll see that the probability is always 1/7.