Math Fundamentals18 sections · 814 units
Open in Course

Perfect Squares - Logarithm Connection (Square roots and logs)

Why logs appear

The number of perfect squares up to nn is n\lfloor \sqrt{n} \rfloor. And n=n1/2=2log2(n)/2\sqrt{n} = n^{1/2} = 2^{\log_2(n) / 2}.

So log2(n)=log2(n1/2)=12log2(n)\log_2(\sqrt{n}) = \log_2(n^{1/2}) = \frac{1}{2} \log_2(n) by the power rule. Square roots and logarithms are related through exponentiation.

This shows up in many algorithms: computing square roots, checking primality, factoring numbers. All involve logarithmic relationships with the input size.