Why are the functions $y=x^{\sin^2(x)}+x^{\cos^2(x)}$ and $y=(x-2\sqrt{x}+1)\cos^2(2x)+2\sqrt{x}$ so similar? I was just playing around with functions and plotting them in Desmos and I found that these functions are remarkably similar despite their totally different expressions. The functions are
$$y=x^{\sin^2(x)}+x^{\cos^2(x)}$$ and $$y=(x-2\sqrt{x}+1)\cos^2(2x)+2\sqrt{x}$$
Link to Desmos page:
https://www.desmos.com/calculator/meyktbtz0i
Edit: They aren't exactly the same if you zoom in closer as pointed out to me.

We have that
$$f(x)=x^{\sin^2(x)}+x^{\cos^2(x)}=x^{1-\cos^2(x)}+x^{\cos^2(x)}$$
$$g(x)=(x-2\sqrt{x}+1)\cos^2(2x)+2\sqrt{x}=$$
$$=(x-2\sqrt{x}+1)\cos^2(2x)+2\sqrt{x}(\cos^2(2x)+\sin^2(2x))=$$
$$=(x+1)\cos^2(2x)+2\sqrt{x}\sin^2(2x)$$
with
$$2\sqrt x \le f(x), g(x) \le x+1$$
and since, as noticed in the graph linked to your question, we have that

*

*at $x=\frac \pi 4 + \frac12k\pi$
$$f(x)=x^{\sin^2(x)}+x^{\cos^2(x)}=2\sqrt x \quad f'(x)=\frac1{\sqrt x}$$
$$g(x)=(x+1)\cos^2(2x)+2\sqrt{x}\sin^2(2x)=2\sqrt x \quad g'(x)=\frac1{\sqrt x}$$

*

*at $x=\frac \pi 2 + \frac12k\pi$
$$f(x)=x^{\sin^2(x)}+x^{\cos^2(x)}=x+1 \quad f'(x)=1$$
$$g(x)=(x+1)\cos^2(2x)+2\sqrt{x}\sin^2(2x)=x+1 \quad g'(x)=1$$
the two functions coincide in infinitely many points with the same slope at these points thus they appear very close one to each other.
