The Gateway to Computer Science Excellence
+1 vote
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 by (167 points) | 69 views
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 Answer

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



by Junior (909 points)

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,385 answers
105,385 users