PROBLEM LINK:
Author: Bhagya Kamal Jain
Tester: Jatin Yadav
Editorialist: Bhagya Kamal Jain
DIFFICULTY:
MEDIUM
PREREQUISITES:
Binary/Ternary Search, Calculus
PROBLEM:
You are given a function f(x)=(x2+b∗x+c)/sin(x) find its minimum value in the interval 0<x<π/2
QUICK EXPLANATION:
Binary Search over x in the range to find the root of it’s derivative. Or Apply ternary search to find the minimum value directly.
EXPLANATION:
You may look at the graph to confirm that f(x) is convex in the interval. Though it is possible to prove it mathematically.
Observe that that the function f(x) is convex in the given interval.
Ie. Its derivative is strictly increasing in the given interval.
Find the root of f’(x) by applying Binary Search. Minimum value of the function occurs at this value.
Then output the value of f(x) for the given x.
ALTERNATE EXPLANATION:
Apply ternary search,read about it here.
Refer to author’s solution for the same.