
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 vectors $\overrightarrow{a}=( \sqrt {3}\sin x,m+\cos x)$ and $\overrightarrow{b}=(\cos x,-m+\cos x)$, and a function $f(x)= \overrightarrow{a} \cdot \overrightarrow{b}$.
(1) Find the analytical expression of the function;
(2) When $x\in\left[-\frac {\pi}{6}, \frac {\pi}{3}\right]$, find the maximum value of the function $f(x)$, and find the corresponding value of $x$.

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