Minimising a function related to a Bloom Filter

  • Thread starter Thread starter delcypher
  • Start date Start date
  • Tags Tags
    Filter Function
delcypher
Messages
5
Reaction score
0
Minimising a function related to a "Bloom Filter"

Homework Statement


I'm looking at a problem that requires me to find k that minimises the function f. Where n,m are to be treated as constants.

Although not needed for this problem the context is that the function f approximately describes the probability of "finding a false positive" when using the bloom filter data structure (computer science). See http://en.wikipedia.org/wiki/Bloom_filter#Probability_of_false_positives

Homework Equations



f(k) = (1 - e^{\frac{-kn}{m}})^k

I already know what the answer should be. Which is the k that minimises f is given by
k_{\text{min}} = \frac{m}{n} \ln(2)

What I want to find out is a good way of getting there. I found a way but it is incomplete because it requires me to know the form of the answer and to use observation to solve for a particular value. So what I'd like to know is

  • Is there a way of completing my proof given later that doesn't require me to use observation (to find j)?
  • Is there a better way of approaching the problem? I may of gone the long way round proving this.

The Attempt at a Solution


My plan is to differentiate f with respect to k and set to 0 and then solve for k.

Firstly I rewrite f.
f = e^{k \ln{\left(1 - e^{\frac{-kn}{m}}\right) }}

\ln{f} = k \ln{ ( 1 - e^{\frac{-kn}{m}}) }

and observe that minimising f is equivalent to minimising \ln{f}

Now via the product rules and chain rule...
\frac{d \ln{f}}{dk} =<br /> \ln{(1 - e^{\frac{-kn}{m}} )} + <br /> \frac{kn e^{ \frac{-kn}{m} } }{m (1 - e^{\frac{-kn}{m}}) }<br /> =0<br />

I now make the following substitution to make the equations easier to write
a = \frac{kn}{m}

so...

\frac{d \ln{f}}{dk} =<br /> \ln{(1 - e^{-a} )} + <br /> \frac{a e^{-a} }{(1 - e^{-a}) }<br /> =0<br />

So now I'm solving for a. I now rewrite the second term using the following...
\frac{a e^{-a} }{(1 - e^{-a}) } =<br /> \ln{(e^{ \frac{a e^{-a} }{(1 - e^{-a}) } } )}<br />

To give...
<br /> \ln{ \left( (1 - e^{-a} ) e^{ \frac{a e^{-a} }{(1 - e^{-a}) } } \right) } = 0<br />

Now re-arranging...
(1 - e^{-a} ) e^{ \frac{a e^{-a} }{(1 - e^{-a}) } } = 1

Now because I know what the answer is supposed to be it hints to me that I should try a form of a such that a = \ln{j} where j is to be found which would give a solution of
k_{\text{min}} = \frac{m}{n} \ln{j}

Substituting that in and rearranging gives
( 1 - \frac{1}{j}) j^{\frac{1}{j-1}} = 1

This is where I get stuck. I can't think of a way to solve the above equation for j. By observation I can see that j = 2 solves it as expected but I don't know how to show that. I can see by plotting it (via GnuPlot) that j=2 is the only solution. I also found that "Wolfram Alpha" was able to solve the equation although it wouldn't explain to me how it did so.Any ideas?
 
Physics news on Phys.org


I received a reply from QuarkCharmer. For some reason it isn't shown here. It was
I admittedly didn't read the whole post, just the end part where you are trying to solve for J. You can take the natural log of both sides of the equation, recalling that:
ln(x^c) = cln(x)

Then you have something like:
\frac{1}{J-1}ln(J-1) = 0
(since the ln of 1 is 0)

You can see that 1/(J-1) has an asymptote at 1, so you can discount it. Then, use the zero product property to solve.

I appreciate the reply but the suggestion does not work. If I take logarithms of both sides I get
<br /> \ln{ \left( ( 1 - \frac{1}{j}) j^{\frac{1}{j-1}} \right)} = 0<br />

From this it is not possible to get to
<br /> \frac{1}{j-1} \ln{ \left( ( 1 - \frac{1}{j}) j\right)} = 0<br />
(which would lead to your suggestion) because only j is to the power of \frac{1}{j-1} and not ( 1 - \frac{1}{j}) j

If I take the logarithm of both sides what I actually end up with is
<br /> \ln{(1 - \frac{1}{j})} - \frac{1}{j-1} \ln{(j)} = 0<br />
which is no easier to solve in my opinion.
 


delcypher said:
I received a reply from QuarkCharmer. For some reason it isn't shown here. It wasI appreciate the reply but the suggestion does not work. If I take logarithms of both sides I get
<br /> \ln{ \left( ( 1 - \frac{1}{j}) j^{\frac{1}{j-1}} \right)} = 0<br />

From this it is not possible to get to
<br /> \frac{1}{j-1} \ln{ \left( ( 1 - \frac{1}{j}) j\right)} = 0<br />
(which would lead to your suggestion) because only j is to the power of \frac{1}{j-1} and not ( 1 - \frac{1}{j}) j

If I take the logarithm of both sides what I actually end up with is
<br /> \ln{(1 - \frac{1}{j})} - \frac{1}{j-1} \ln{(j)} = 0<br />
which is no easier to solve in my opinion.

Hey delcypher.

I would take QuarkCharmers advice.

The logarithm function is unique for all valid values.

Basically what happens is that (1 - 1/j)j^(1/(j-1)) = 1. Now let's get it in terms of one log term which gives us:

(2-j)/(j-1)ln(j) + ln(j-1) = 0

Now j > 1 since ln(j-1) is only defined when this is the case. Now (2-j)/(j-1) is monotonic increasing for j <= 2. Now RHS is also monotonically increasing as well for j > 1.

From the equation you can see that j = 2 is one solution, but to show it's the only solution you should show what the turning points of this function are and that using various theorems like say the mean-value theorem you can show that it is the only root if this is the case (I haven't checked, but I would basically do what I said above).
 
Prove $$\int\limits_0^{\sqrt2/4}\frac{1}{\sqrt{x-x^2}}\arcsin\sqrt{\frac{(x-1)\left(x-1+x\sqrt{9-16x}\right)}{1-2x}} \, \mathrm dx = \frac{\pi^2}{8}.$$ Let $$I = \int\limits_0^{\sqrt 2 / 4}\frac{1}{\sqrt{x-x^2}}\arcsin\sqrt{\frac{(x-1)\left(x-1+x\sqrt{9-16x}\right)}{1-2x}} \, \mathrm dx. \tag{1}$$ The representation integral of ##\arcsin## is $$\arcsin u = \int\limits_{0}^{1} \frac{\mathrm dt}{\sqrt{1-t^2}}, \qquad 0 \leqslant u \leqslant 1.$$ Plugging identity above into ##(1)## with ##u...
Back
Top