in Algorithms
1,247 views
2 votes
2 votes
Q1) f(n) = n^(1-sin n)

       g(n) = n^(1+cos n)

Relation between them ?

 

Q2) f(n) = n^(1-sin n)

       g(n) = n^(2+cos n )

Relation between them ?
in Algorithms
1.2k views

1 comment

Both can't be compared.

A) Here, $f(n)$=$n^{(1-sin n)}$ and $g(n)=n^{(1+cos n)}$

when $n=0$ then $f(0)=g(0)=0$

when $n=\pi /4 $  then $f(\pi/4)>g(\pi /4)$

when $n=\pi /2 $  then $g(\pi/2)>f(\pi /2)$

when $n=\pi  $  then $f(\pi)>g(\pi)$

when $n=1 $  then $f(1)=g(1)$.

Since, trigonometric functions are periodic in nature. both sin and cosine has period = $2 \pi.$ It means after $2 \pi$ they will show the same nature again and again for particular value of 'n'. someone will increase sometimes or someone will decrease sometimes because both sin and cosine functions oscillates between 0 and 1.

Now, to prove it asymptotically,

$\lim_{n\rightarrow \infty } \frac{f(n)}{g(n)} = \frac{1-sin n}{ 1+cosn}$ because base is same. Now limit does not exist here So, we can't say which has higher growth rate or we can say both can't be compared.

Same reasoning is for $(B)$
1
1

1 Answer

0 votes
0 votes

1) This problem can be divided into 3 cases based on the range in which n lies and how trigonometric function varies within that range.3 cases are as follows:-

  1. ∀n,n∈[0, π/2 ], g(n)>f(n),and so f(n)=O(g(n))
  2. ∀n,n∈[π/2 , 3π/2 ],g(n)>f(n),and so f(n)=O(g(n))
  3. ∀n,n∈[π/2 , 3π/2 ],f(n)>g(n), and so f(n)= Ω(g(n))

And 1-3 will repeat for all subsequent values of sin and cos function as they are periodic in nature.So, from 1-3 we can observe that no specific relationship can be established between f(n) & g(n) as they behave differently in different ranges.

2)Same logic as 1