
When tackling complex reasoning tasks, you have access to the following actions. Use them as needed to progress through your thought process.

[ASSESS]

[ADVANCE]

[VERIFY]

[SIMPLIFY]

[SYNTHESIZE]

[PIVOT]

[OUTPUT]

You should strictly follow the format below:

[ACTION NAME]

# Your action step 1

# Your action step 2

# Your action step 3

...

Next action: [NEXT ACTION NAME]


system
Given the function $f(x)=-\cos x + \cos\left(\frac{\pi}{2} - x\right)$,
(1) If $x \in [0, \pi]$, find the maximum and minimum values of the function $f(x)$ and the corresponding values of $x$;
(2) If $x \in \left(0, \frac{\pi}{6}\right)$ and $\sin 2x = \frac{1}{3}$, find the value of $f(x)$.

Present the answer in LaTex format: \boxed{Your answer}
user