### log base 2

It turns out that the number 1 reason people visit this blog is to calculate log base 2 of an integer. So here is log

log

log

log

log

log

log

log

log

log

log

Note that log

log

Some cases deserve special mention. log

The logarithm is useful for a variety of purposes. One of the more common is when describing exponential growth or decay. For example, the time for a radioactive substance to decay to half its mass is called the

In computing, log

Although I can't provide additional help to people with logarrhythmias, I hope this note is of some assistance.

_{2}of 1 through 10, to 16 digits precision:log

_{2}(1) = 0log

_{2}(2) = 1log

_{2}(3) = 1.584962500721156log

_{2}(4) = 2log

_{2}(5) = 2.321928094887362log

_{2}(6) = 2.584962500721156log

_{2}(7) = 2.807354922057604log

_{2}(8) = 3log

_{2}(9) = 3.169925001442312log

_{2}(10) = 3.321928094887362Note that log

_{2}(*x*) is defined for any*x*greater than zero. If you have a calculator than computes the natural logarithm (often denoted ln), then you can calculate log_{2}(*x*) = ln(*x*)/ln(*2*). The same thing works with log base 10, i.e. log_{2}(*x*) = log_{10}(*x*)/log_{10}(*2*).**But what does it***mean*?log

_{2}(*x*) means the power you have to raise 2 in order to get*x*. For example, 2^{2}= 4, so log_{2}(4) is 2. Similarly, 2^{3}= 8, so log_{2}(8) = 3. It turns out that 2^{1.58496}is very nearly 3, so log_{2}(3) is roughly 1.58496.Some cases deserve special mention. log

_{2}(2) = 1 because 2^{1}is 2. log_{2}(1) = 0 because by mathematical convention 2^{0}= 1 (this holds not just for 2, but for any base). Finally, note that log_{2}(0) is undefined, although some software will return -Infinity (which is the limit of log_{2}(*x*) as*x*approaches zero).**What is it used for?**The logarithm is useful for a variety of purposes. One of the more common is when describing exponential growth or decay. For example, the time for a radioactive substance to decay to half its mass is called the

*half life*. Similarly we can describe accelerating growth in terms of the*doubling time*. I previously applied this to the number of blogs tracked by Technorati.In computing, log

_{2}is often used. One reason is that the number of bits needed to represent an integer*n*is given by rounding down log_{2}(*n*) and then adding 1. For example log_{2}(100) is about 6.643856. Rounding this down and then adding 1, we see that we need 7 bits to represent 100. Similarly, in order to have 100 leaves, a binary tree needs log_{2}(100) levels. In the game where you have to guess a number between 1 and 100 based on whether it's higher or lower than your current guess, the average number of guesses required is log_{2}(100) if you use a halving strategy to bracket the answer.**Two much of nothing**Although I can't provide additional help to people with logarrhythmias, I hope this note is of some assistance.

Labels: binary, exponential, exponential decay, exponential growth, log base 2, logarithm, mathematics

## 108 Comments:

Another good use of log 2 is related to those "intelligent design" advocates who like to prattle about "complex specified information" and "information theory". When an IDiot is in full spate about how information theory disproves evolution and provides evidence for an intelligent designer, sweetly ask him (it's usually a him), "So what's log 2 all about in that context?"

Then continue to smile during the subsequent arm-waving and ducking and weaving. I hypothesize that 19 times out of 20, the IDiot will be at a loss. (Now for some field work!)

Yep. I think it's a case of seeing the splinter in someone else's eye, but not the

login one's own.I am stuck with a log 2 equation, so any help is appreciated :

How to get x value for :

x - 8 lg(x) = 0

Thanx

Well, by trial and error it's about 1.1, but to solve it properly you need to use an iterative algorithm like Newton's method. You can do it in Excel using Solver.

yeye, be careful: there are two solutions, one ca. 1.12, and one ca. 35.

Once you know the ``ballpark figure'', a small 2 line program can do the rest.

Interesting problem using natural logs. The equation ax = ln x has two solutions if a is sufficiently small, zero if too large, and one solution at the boundary. What is that boundary?

At the boundary, the slopes of both sides of the equation have to be equal -- otherwise, ln x would cross ax up and then cross back down. So at the boundary, a = 1/x.

That means, ln x = ax = a/a = 1, or x = e, and a=1/e.

Thanks Piotr and John!

Hi,

I would like to thank you, I'm having digital communication and I was very confused to understand log2 …

Best regards,

Abdulrahman

From www.arabou.org.sa

You are very welcome.

Regards,

Nick

Hi Nick,

I'm still kind of confused. I am a biochemist who is useless at maths. I just got affymatrix data back 'normalized for gene expression log2'. Can I directly compare 2 different genes? For example If I have gene 1 log2 1.2 and gene 2 log2 2.4 does that mean gene 2 is expressed twice as much as gene 1?

Kind regards,

Pat (Ireland)

I don't have much experience with microarray data, but I did find a good powerpoint presentation about how such data are normalized and transformed.

But taking log2 of 2x gives 1+log2(x). So in your example, I would conclude that gene 2 is expressed a bit more than twice as much as gene 1.

By the way, it's -20 Celsius here. I wish I were in Ireland!

Thanks very helpful, I been all over the internet and found nothing straight forward as your explanation for log2.

Good to hear.

helpful.... whats mean of ln ??????

ln means the natural logarithm, which is the logarithm to the base

e, wheree= 2.718282...2 ^ 1.58496

2.99999

2 ^. 3

1.58496

Do you have a question? (Also, note that 2^.3 is approximately equal to 1.231144.)

Dear Barrowman,

Why you cannot calculate log2(minus data)?

Exp: Log2(-2)=?

Because there's no answer. The logarithm (using any base) is only defined for positive numbers. In your example, there is no power that 2 can be raised to that will give -2.

Thanks for the log calc.

Works great.

Nick,

Brilliantly clear explanation. This falls into the category of "stuff I used to know, should still know, but have completely forgotten!". Thanks for the old gray cell refresh!

whats log4(2)

Log base 4 of 2 is the power to which you have to raise 4 to get 2. That's 0.5 (the square root).

can you prove that there are no integers (p/q) solutions for log base 2 of 3??

I would try a proof by contradiction.

thank you buddy........i was banging my head behind this for last 2 days!!!

A very usefull formula! *****

Hi!

Tnx for a short and simple definition of logn(x) in log2(x) = log10(x)/log10(2)... helped a lot!

Peace

if n ^ x = y (meaning n to the power of x = y )

then x * log(n) = log(y)

so x = log(y) / (log(n)

e.g. 2^x = 8

x=3

Yes.

In reply to the question above about log2(-2):

ln(-2) = ln(2) + pi*i, where i=sqrt(-1)

so log2(-2) = ln(-2)/ln(2)

yooooo, I just want to say thanks for the simple log base 2 calculator.

No problem, glad it's helpful!

no wonder google landed me up here... thanks a lot for the explanation..

regards

Basu

Hey, I'm doing masters n I've a problem in one of my optical fiber problems, lik

1*10^-4 = (1/N)*(.95)^(log (base 2)N) So, How do i find N now? But, the answer for N is 5301.

can anyone say where log base 2 is exactly used?????

thank you

@anonymous : maybe for the bits? binary thing, binary is base of 2.

Can you show that if N = q^k (with N, q, and k all positive integers), then either k <= logN or N = 1.

Explanation is very apt. I am not a math student but needed to use log table for academic purpose. I went through numerous sites, but none of them explained so well as your site did. Thank you

superrrrrrrrrrrrrb

how do you calculate log base 2 in Excel or Systat 12? Thanks

Not sure about Systat 12, but in Excel, if you want to calculate log base 2 of 32 (for example), you type the following into a cell:

=log(32)/log(2)

and the answer is 5, because 2 to the power of 5 is 32.

For the person that asked where LOG is useful. A simple function that returns the binary representation of a number passed to it.

FUNCTION Bin$ (n&)

FOR p% = 0 TO INT(LOG(n& + .1) / LOG(2))

IF n& AND 2 ^ p% THEN s$ = "1" + s$ ELSE s$ = "0" + s$

NEXT p%

IF s$ = "" THEN s$ = "0"

Bin$ = s$

END FUNCTION

Thanks, Anonymous! That's terrific.

For those who don't recognize it, the function above can be used in Excel. From within Excel, you have to go into the Visual Basic Editor, and then paste that code in. For step-by-step details on that, see this article on How do I create a user-defined function in Microsoft Excel.

Once I did this, I was able to use the Bin function just as Anonymous described.

what is log -9 base 3? i think -2 is the answer. pls anyone describe me.........

The logarithm of a number, regardless of the base, is only defined if that number is positive. So the log -9 base 3 is not defined.

Thanks for all the help provided, it was very useful !

it was really helpful... really i finally got what log base x(x)is!!!!!!

thank u

log de 2 en base 7 = a

log de 28 en base 1/2 = ?

please!!!

I want the rawl to change base 2 to base 10 and vise versa.

Hi

If you pls prove the equation that change base 2 to base 10 and vise versa.

thanks

What is -(1/2)log A

Hi .

How I CAN do THIS??

: Log 27 in base 0,2

Plase , i just need help.Thank you =D

Simplest ever description... so fundamental and easy to digest...

Thanks you for solving my log base 2 mystery :)

Hi Nick,

I came across your website while trying to understand the change-of-base-theorem to find the logarithm, but now I'm completely lost trying to solve for the exponential equation below:

5^x+2 = 3^2x-2

I was wondering if you happen to have any suggestions?

Thanks in advance

I would expect that there is no closed-form solution to that equation. You could solve it numerically using an equation solver (e.g. Newton's method or a more sophisticated numerical method).

How do you enter this in to a calculator? e.g. how would I know what power to raise the 4 to in the equation: (log 8) to the base 4. Is there an easy way to put it in to the calculator so it will tell me what power I should raise it to?

Help would be much appreciated, Thanks in advance

If you would like to calculate log base 4 of 8, you would first calculate log10 of 8 (which is approximately 0.90309) and then divide that by log10 of 4 (which is approximately 0.60206), which gives 1.5. So 4 raised to the power of 1.5 is 8.

rt0=1,5D+-x1,x2...

tano

Natural Log:

log base e (x) < same named ln (x)

Most Known Others:

log base 2 (x)

log base 10 (x) < same named lg (x)

As well its so:

log base 2 (4)

OR you can say:

2^x=3

In root, you can type so:

x^2=4

That means log and Root are the <> of ^.

Easy way, and how to use log, i mean how to find out the x? Easy here:

log base 2 (4) = x

2^1 = 2, 2^2 = 4

x = 2

Same here:

log base 7 (343) = x

7^1 = 7, 7^2 = 49, 7^3 = 343 ;

x = 3

So you can use,know, and think what root and log is.

-TehMathematicsTeacher

Hi Nick,

Thanks for the wonderfull explanation on the log2(x) issue. I was also looking for it because of microarray data, just like someone else in this thread. You were right with your answer to him: the value represents how much gene expression in one group differs from gene expression in another group. However, once you have calculated these Logs's, they are only usefull to easily see what genes have the biggest differences between groups: being either the biggest negative number (highest expression in group 1) or the biggest positive number (being highest in group 2). The values cannot be compared with eachother as you suggested in your reply.

I have a question for myself as well: in your explantion you used the ln, but when someone asked how to put it in Excell you simply took the 10log(x)/10log(2) in stead of ln(x)/ln(2). In understand it is the same, but why then use the ln in your explantion? Are there circumstances in which it matters which one you use?

Thanks, Anonymous. The only difference between the log and ln functions is a multiplicative constant, so when you take a ratio (log/log or ln/ln) it makes no difference.

To complicate matters, not everyone uses the same notation: depending on the application, log can mean log base 10, or ln, or log base 2. In most programming languages the log function computes ln, and there is often a log10 function to compute log base 10. But in Excel, the log function computes log base 10, and the ln function computes the natural logarithm.

Hi Nick, thank you so much for all information about log base 2. I was looking for it because i'm working on microarrays data too. Your explanation was very usefull for me!!

I ended up downloading my calculator's manual, still no help.

>>log2(x) = ln(x)/ln(2). The same thing works with log base 10, i.e. >>log2(x) = log10(x)/log10(2).

These two lines were the one I was looking for! Thank you!

Thanx nick!

I had a problem related to Shannon's law, ur blog helped me to some extent.

Regards from

Aadil Rehman Bhat

Thank you so much. You have explained it in very simple terms. It helped me a lot.

thank u vry much

Log2 is commonly used in microarray data, and many other types of biological or biochemical data in which values can increase or decrease from a baseline. The reason log2 is useful in these cases is because a 2-fold increase in gene expression (using microarray as example) would take a value from baseline of say 100% (normalized baseline) to 200%. The same magnitude decrease (2-fold) drops the value from 100% to 50%. When plotted as bar graph, it appears that the increase is greater than the decrease, but they are in fact the same magnitude. The effects get even more visually challenging when larger fold differences are plotted, say 10 or 100 fold. When converted to log2 scale, the increases and decreases of the same magnitude show the same size differences in the bar chart - a visually more pleasing and "accurate" presentation. Log2 is therefore is one way to "stop lying with statistics."

how to solve -9/4 log base 2 of 9/4

log base 2 of 9/4=(log base 10 9/4) * 3.32

Great Post!

wait a minute.... isnt log2(100)=10 sincei 10^2=100? why the writers claims it to be 6.643856 since 6.643856^2~= 44

I got confused....

excellent work,got a lot of help :) Thank you

thanks

Hi Nick,

Thanks for all the information about Log2. Currently I am using Log2 in excel but I just noticed that some values are slightly different to those obtained using your calculator instead.

e.g. Log(0.88,2)= -0.1776 (in excel) and using your calculator is: -0.1844

Is it something wrong with excel?

Cheers,

Omar.

That's very strange. On my copy of Excel, it gives -0.18442.

10000 = 3000 log(base 2)[1+k]

solve for k..pls mention the steps

i have a question.how can i prove which is bigger without taking any number as a example? m^n or n^m?

any idea how can i prove with taking log into calculation?

Thank you for your formula!!!

I never learn abou a log and i am also very bed in maths and its formula, even log.

So anyone tell me that how to calculate the log base 2 easily or calculate without the calculator.....

Please help me friendsssssss

Log2 is also used for the calculation of the entropy.

Thank You for the help

what will be the value of log base 2[1/p(x)]...

any answers?

thanks

thanks

I came to the log calculator because I wanted to know how to write the little 2.. I copy pasted it in the end!

any body know the better formula compare to that formula to reduce the value min{1+ log2 frequency, frequency}

Your arrogance is surpassed only by your ignorance.

merge Newton log 8 power (-10) its value may be equal to Golden ratio in the following merger Its a Newton Log with golden ratio

sea land Shipping main merger 740

mares k Line main merger 640 Mares k Line

Swiss Bank Corporation main merger 540 Swiss Bank Corporation

Thanks

if log2n= 128 then how will you get n from it. ??

how to solve this equation (log2 n = 128 )for n ??

if log2n= 128 then how will you get n from it. ??

This comment has been removed by the author.

2/5<log3base 10<1/2 prove that

mazhar ur answer will be 1*10^128/2

Mazhar ur answer will be n= 2^127

=> log2(2n)=128

=> log2(2n)= log2(2^128)

=> 2n = 2^128

=> n= 2^128/2

=> n=2^127

How do I get log 1/8 base 3

how can i get log2 x+1

Nick plz give solution of (logbase2 x)^2

Nick plz give solution of (logbase2 x)^2

Dear Nick,

Thanks for your great explanation and graph!

Still useful in 2017! :-)

Got here searching for answers to Bio-O notation and whether Big-O O(n*logn) stood for base 10 or base e. Turns out it's related to the number of child nodes in a tree. I think I used 2 nodes, so it's base 2 instead. Thanks for your really clear explanation!

Jennifer

please remove the lizard from side. It's very distracting and freaky

I can't speak for everyone, but the reason I use this is out of curiosity to figure out how much faster a binary search of n is than a sequential search of n

This comment has been removed by the author.

An electronics company has made an oscillator that can generate a sine wave, which changes so rapidly that it’s interval of the wave can’t be determined. What will be the frequency of this sine wave? pleae tell me this answer... adilhakeem90@gmail.com

thanks it really helps me in my exam

Can you help me to log 2(1048) in a HTML format. I know it gives 10, but how to make the HTML calculation format. I have tried sum(2˄1024) and sum(log2(1024)) but it is not working

## Post a Comment

<< Home