Edit
Solution with Maximize.
Maximize works best with linear and polynomial expressions.( See help function) Therefore using variable transformations.
an = x^n - x^(2 n) // Factor
(* -x^n (-1 + x^n) *)
max = Maximize[{an /. x^n -> xn, 0 <= xn <= 1}, xn]
(* {1/4, {xn -> 1/2}} *)
Solve[(xn /. max[[2]]) == x^n && 0 <= x <= 1 && n > 0, x]
(* {{x -> ConditionalExpression[2^(-1/n), n > 0]}} *)
A solution with Reduce
Didn't get Maximize to extract max of an
from red
.
Example from comment.
Since x and y are form 0 to Pi/2, eliminating Cos and convering Sin[x] == sx, Sin[y] == sy.
anequ = an==n(Sin[x] + Cos[y] + Cos[x - y])//TrigExpand
(* (0 <= x <= \[Pi]/2, 0 <= y <= \[Pi]/2) *)
eli = Eliminate[{anequ, Sin[x]^2 + Cos[x]^2 == 1,
Sin[y]^2 + Cos[y]^2 == 1, Sin[x] == sx, Sin[y] == sy}, {Cos[x],
Cos[y]}]
sol1 = First@
Solve[{Sin[x] == sx, Sin[y] == sy, 0 <= x <= Pi/2,
0 <= y <= Pi/2}, {x, y}] //
Simplify[#, {0 <= x <= Pi/2, 0 <= y <= Pi/2}] &
eli2 = List @@ (eli /. sol1 // Simplify)
(* {an^4 + 4 n^4 sx^2 (1 + sy)^2 (-1 + sx^2 + sy^2) +
4 an^2 n^2 (1 + sy) (-1 + sy + sx^2 (2 + sy)) ==
4 an n sx (1 + sy) (an^2 + 2 n^2 (1 + sy) (-1 + sx^2 + sy)),
0 <= sy < 1 && 0 <= sx < 1} *)
max = Maximize[{an, eli2 && n > 0}, {an, sx, sy}] //
Simplify[#, Assumptions -> Element[n, Integers] && n > 0] &
(* {(3 Sqrt[3] n)/2, {an -> (3 Sqrt[3] n)/2, sx -> Sqrt[3]/2, sy -> 1/2}} *)
{x -> ArcSin[sx], y -> ArcSin[sy]} /. max[[2]]
(* {x -> Pi/3, y -> Pi/6} *)