I'm not very good at math; However I have a scenario where I'm trying to find the chance of duplicate for randomly generated data.
In a nuttshell I have a "bag" with 62 different items, lets say a person selects an item and puts it back into the bag 40 times. During this time we log the item that the person had obtained in order.
What is the chances of another person selecting the same items in the same exact order from the baggy?
What formula would be used for this? (Please explain it, as I've never been good at formulas, but I can definately plug things in and do some math)
As mentioned by Andre in the comments above, assuming all objects in your bag are distinct, the action of grabbing an item and putting it back away and recording the exact order in which each item was grabbed corresponds to the possible sequences obtained with each entry in the sequence as anything from the bag.
Small example: If the bag has an Apple, Banana, and Coconut (shortened to $A,B,C$) and we grab and replace a total of two times, we could get the sequences $AA,AB,AC,BA,BB,BC,CA,CB,CC$. Assuming the probability of picking each item is the same then all sequences are equally likely.
How many sequences exist for $n$ objects in the bag taken and replaced a total of $k$ times?
Via multiplication principle we can break it into steps: Step 1-pick the first entry in the sequence ($n$ possibilities). Step 2-pick the second entry in the sequence ($n$ possibilities). Step 3-(repeat)... Step 4-(repeat)...,...Step $k$-pick the kth entry in the sequence ($n$ possibilities). As per multiplication principle, the total number of sequences then is the product of the number of choices at each step of the process. Therefore there are $n\times n\times\dots \times n = n^k$ different sequences.
As each sequence is equally likely, after the first person makes their selections, regardless what it was, the second person will get the same sequence of selections with probability $\frac{1}{n^k}$
Going back to my example with the fruit, there are 3 kinds of fruit and we are grabbing twice. So, in the example I gave, $n=3$ and $k=2$. $n^k = 9$ which matches the number of sequences listed out above, and picking a specific sequence occurs with probability $\frac{1}{9}$