[Math] how many trials of independent event with probability p needed to reach chance q of at least one success

probability

Given an independent event with probability $p$ and a number of trials $k$, if I want there to be a probability of at least $q$ that the event has occurred at least once, how big does $k$ have to be in terms of $p$ and $q$?

As a concrete example:
An event could be I have a bag of $10$ balls with only $1$ blue ball and my event is to randomly pick a ball out of the bag and check if it is blue. (then return the ball)
I would like to fix upfront the maximum number of attempts I will do but I want at least an $80%$ chance of picking the blue ball in at least one of my attempts.
It's been a while since I did any probability but here are some of my starting thoughts..

If I wanted a $10\%$ chance then I would simply choose one trial $(p=0.1,q=0.1,k=1)$
However no finite number of trials could give me $100\%$ chance.

Looking at it the other way I can see that if I have three trials then the probablility of getting at least one success is $0.1 + (0.9)(0.1) + (0.9)(0.9)(0.1) = 0.1 + 0.09 + 0.081 = 0.271$
(or look at it as $p + (1-p)p + p(1-p)^2$ – I'm rusty on how to write that for any k but know it's simple enough.)

I have looked at the question Calculating number of independent trials needed for event to occur at least n times , which seems to me to be a more general form of the problem where there must be $n$ number of successes, so I'm hoping with $n$ fixed at 1 the answer is simpler.

Best Answer

Let the event that we want to occur be $X$. Then for $k$ trials, $P(X = 0) = (1 - p)^{n}$. $P(X \geq 1) = 1 - P(X = 0)$, so to find $k$ for a desired total chance of $q$, we have \begin{align*} q &= P(X \geq 1) \\ q &= 1 - P(X = 0) \\ q &= 1 - (1 - p)^{k} \\ (1 - p)^{k} &= 1 - q \\ k &= \log_{(1 - p)} (1 - q) \\ k &= \frac{\ln (1 - q)}{\ln (1 - p)} \end{align*}