# Revision history [back]

To better specify the question, one would need to say if we want to solve for $z$ in $\mathbb{Z}$, $\mathbb{Q}$, $\mathbb{R}$, $\mathbb{C}$, or other.

Here we examine how to solve over $\mathbb{C}$.

Define $z$ as a symbolic variable, and define the equation (as you did).

sage: z = SR.var('z')
sage: eq = sqrt(-4*z^2 + 2*sqrt(-4*z^2 + 1) - 1) == 0

sage: solve(eq, z)
[z == -1/2*sqrt(2*sqrt(-4*z^2 + 1) - 1), z == 1/2*sqrt(2*sqrt(-4*z^2 + 1) - 1)]


First notice that $\sqrt{\operatorname{expression}} = 0$ is equivalent to $\operatorname{expression} = 0$. This gets you rid of one of the square roots.

sage: eqq = eq^2
sage: eqq
-4*z^2 + 2*sqrt(-4*z^2 + 1) - 1 == 0


Then isolate the other square root.

sage: eqqq = eqq + 4*z^2 + 1
sage: eqqq
2*sqrt(-4*z^2 + 1) == 4*z^2 + 1


Remove it by squaring. Note that the new equation is implied by the initial one, but no longer equivalent to it.

sage: eqqqq = eqqq^2
sage: eqqqq
-16*z^2 + 4 == (4*z^2 + 1)^2


Solve the new equation.

sage: sols = solve(eqqqq, z)
sage: sols
[z == -1/2*sqrt(2*sqrt(3) - 3), z == 1/2*sqrt(2*sqrt(3) - 3), z == -1/2*sqrt(-2*sqrt(3) - 3), z == 1/2*sqrt(-2*sqrt(3) - 3)]


Check which of the solutions are solutions of the initial equation.

sage: [bool(eq.subs(s).simplify_full()) for s in sols]
[True, True, False, False]


To better specify the question, one would need to say if we want to solve for $z$ in $\mathbb{Z}$, $\mathbb{Q}$, $\mathbb{R}$, $\mathbb{C}$, or other.

Here we examine how to solve over $\mathbb{C}$.

Define $z$ as a symbolic variable, and define the equation (as you did).

sage: z = SR.var('z')
sage: eq eq_a = sqrt(-4*z^2 + 2*sqrt(-4*z^2 + 1) - 1) == 0

sage: solve(eq, solve(eq_a, z)
[z == -1/2*sqrt(2*sqrt(-4*z^2 + 1) - 1), z == 1/2*sqrt(2*sqrt(-4*z^2 + 1) - 1)]


First notice that $\sqrt{\operatorname{expression}} = 0$ is equivalent to $\operatorname{expression} = 0$. This gets you rid of one of the square roots.

sage: eqq = eq^2
sage: eqq
eq_b = eq_a^2
sage: eq_b
-4*z^2 + 2*sqrt(-4*z^2 + 1) - 1 == 0


Then isolate the other square root.

sage: eqqq = eqq eq_c = eq_b + 4*z^2 + 1
sage: eqqq
eq_c
2*sqrt(-4*z^2 + 1) == 4*z^2 + 1


Remove it by squaring. Note that the new equation is implied by the initial one, but no longer equivalent to it.

sage: eqqqq = eqqq^2
sage: eqqqq
eq_d = eq_c^2
sage: eq_d
-16*z^2 + 4 == (4*z^2 + 1)^2


Solve the new equation.

sage: sols = solve(eqqqq, sols_d = solve(eq_d, z)
sage: sols
sols_d
[z == -1/2*sqrt(2*sqrt(3) - 3), z == 1/2*sqrt(2*sqrt(3) - 3), z == -1/2*sqrt(-2*sqrt(3) - 3), z == 1/2*sqrt(-2*sqrt(3) - 3)]


Check which of the solutions are solutions of the initial equation.

sage: [bool(eq.subs(s).simplify_full()) [bool(eq_a.subs(s)) for s in sols]
sols_d]
[True, True, False, False]


Define the solutions of the original equation:

sage: sols_a = [s for s in sols_d if bool(eq_a.subs(s))]
sage: sols_a
[z == -1/2*sqrt(2*sqrt(3) - 3), z == 1/2*sqrt(2*sqrt(3) - 3)]