Why is $K\cdot f(n) + L \cdot g(n) \leq (K+L) \cdot (f(n) + g(n)) $?

37 Views Asked by At

$K\cdot f(n) + L \cdot g(n) \leq (K+L) \cdot (f(n) + g(n)) $

$n, f(n), g(n), K, L \in R^+$

I've seen this inequality a few times in my algorithms course, but I am trying to understand how it works. I would also like to know if it has a name.

An example of someone using it is in the solution to R-3.16

2

There are 2 best solutions below

0
On

Since $K, L, f(n), g(n)$ are all non-negative numbers, expanding the right hand side of the inequality gives the left hand side plus something non-negative.

0
On

$$(K+L).(f(n) + g(n)) = K.f(n) + L.g(n) + K.g(n) + L.f(n)$$

if $K.g(n) \geq 0$ and $L.f(n) \geq 0$ then they only increase the value of the RHS which makes it greater than or equal to the first two terms: $K.f(n) + L.g(n)$. Hence: $$K.f(n) + L.g(n) \leq (K+L).(f(n) + g(n)) $$