Came across the following question:
Given a coin with probability $0< p< 1$ to fall on "head". Tossing it independently. Given $n,m\in\mathbb{N}$ what is the probability to get $n$ "head"s before $m$ "tail"s?
My approach was: the n heads need to occur in the $(n+m-1)$ first tosses.
There're $n+m-1\choose n$ ways to pick $n$ elements from this group. In each pick, we need to have $n$ heads meaning the probability is $p^n$.
Summing all up I get ${n+m-1\choose n}\cdot p^n$.
The result in the book is: $\sum_{k=n}^{m+n-1}{n+m-1\choose k}\cdot p^{k}\cdot (1-p)^{n+m-1-k}$ which I don't understand why.
You were on the right track, but not quite there. You were trying to caluclate the probability for obtaining exactly $n$ heads before the $m$~th tail. That is the probability for obtaining $n$ heads and $m-1$ tails among $n+m-1$ tosses, and then a tail on the next toss.$$\dbinom{n+m-1}{n}\cdot p^n\cdot (1-p)^{m}$$
However you were ashed for the probability for obtailing at least $n$ heads before $m$ tails. That is the probability for obtailing $n$ or more tails among the first $n+m-1$ tosses, and then whatever on the tosses after that.
$$\sum_{k=n}^{n+m-1}\dbinom{n+m-1}{k}\cdot p^k\cdot (1-p)^{n+m-1-k}$$