# Manipulating equations into a certain form

I am a newbie in Mathematica, and I want to know how to manipulate and derive an equation. The equation I want to obtain is as shown on the image. I've tried Solve, Simplify, FindRoot, Expand, Reduce and others but I can't seem to find the answer. I included the code I wrote below.

• I transformed the 2 equations into ABCD matrix of Ex and Ey
• As Ex and Ey only have solutions when the matrix determinant is zero (Det[m]==0 or AD=BC), I tried to include that in the code but to no avail.
• I want the final output to be in the form shown inside the square

Please kindly help me with this problem. I have been having similar problems but if I can manage to solve this one I think I'll be able to solve the others too.

ClearAll["Global*"]

m = {{\[Omega]^2 - \[Omega]h^2,
j (\[Omega]pe^2 \[Omega]ce)/\[Omega]}, {-j (\[Omega]pe^2 \
\[Omega]ce)/\[Omega], (\[Omega]^2 -
c^2 k^2) (1 - \[Omega]ce^2/\[Omega]^2) - \[Omega]pe^2}};

a = m /. \[Omega]h^2 -> \[Omega]pe^2 + \[Omega]ce^2;
(*LogicalExpand[a\[Equal]0]*)
Reduce[Det[a] == 0, {c, k}]

• As set up, you are trying to solve for two variables with only one equation. What you want, I believe, is to find the NullSpace of that matrix after forcing the determinant to be zero (that null vector will give your solutions up to scaling). Could do solns = Solve[Det[a] == 0, c]; NullSpace[a /. solns[[1]]] Mar 23, 2021 at 15:09

Clear["Global*"]


If j is intended to represent Sqrt[-1] then it is I in Mathematica. Assuming that is the case:

m = {{ω^2 - ωh^2, I (ωpe^2 ωce)/ω},
{-I (ωpe^2 ωce)/ω, (ω^2 - c^2 k^2) (1 - ωce^2/ω^2) - ωpe^2}};

a = m /. ωh^2 -> ωpe^2 + ωce^2;

sol = Solve[Det[a] == 0, {c, k}]

(* Solve::svars: Equations may not give solutions for all "solve" variables.

{{k -> -(Sqrt[ω^4 - ω^2 ωce^2 -
2 ω^2 ωpe^2 + ωpe^4]/Sqrt[
c^2 ω^2 - c^2 ωce^2 - c^2 ωpe^2])}, {k ->
Sqrt[ω^4 - ω^2 ωce^2 -
2 ω^2 ωpe^2 + ωpe^4]/Sqrt[
c^2 ω^2 - c^2 ωce^2 - c^2 ωpe^2]}} *)

expr = c^2 k^2/ω^2 /. sol // Simplify

(* {(ω^4 + ωpe^4 - ω^2 (ωce^2 +
2 ωpe^2))/(ω^2 (ω^2 - ωce^2 - ωpe^2)),
(ω^4 + ωpe^4 - ω^2 (ωce^2 +
2 ωpe^2))/(ω^2 (ω^2 - ωce^2 - ωpe^2))} *)


Are there any known constraints on any variables? Real? Positive real? Inequalities?

First of all, your Mma notations are different with respect to what you show as the image. For example, in the image you use \[Omega]ce and \[Omega]pe and then you pass to \[Omega]c and \[Omega]p. This is highly misleading and time-consuming to guess what precisely you have in mind. Please the next time be consistent in your questions.

Second, there is a special letter I that is reserved in Mma for the imaginary unit, rather than j. I corrected this by substitution:

m = {{\[Omega]^2 - \[Omega]h^2,
j (\[Omega]p^2 \[Omega]c)/\[Omega]}, {-j (\[Omega]p^2 \[Omega]c)/\
\[Omega], (\[Omega]^2 -
c^2 k^2) (1 - \[Omega]c^2/\[Omega]^2) - \[Omega]p^2}} /. j -> I;

a = m /. \[Omega]h^2 -> \[Omega]p^2 + \[Omega]c^2;


The equation to solve is. It is convenient to replace c^2->x:

eq1 = Det[a] == 0 /. c -> Sqrt[x];


Let us solve it with respect to x:

eq2 = Equal @@ Solve[eq1, x][[1, 1]]


Now, let us divide the both sides by w^2 and multiply by k^2:

eq3 = Assuming[{\[Omega]^2/k^2 != 0},
DivideSides[eq2, \[Omega]^2/k^2]] /. \[Omega]c ->
Sqrt[\[Omega]h^2 - \[Omega]p^2]


Now, let us replace in the lhp x by c^2 and transform the rhp a bit:

eq4=MapAt[Apart[
Simplify[#, {\[Omega] > 0, \[Omega]p > 0, \[Omega]c >
0, \[Omega]h > 0}]] &,
eq3, {2}] /. {x -> c^2, \[Omega]p -> Subscript[\[Omega],
p], \[Omega]h -> Subscript[\[Omega], h]}


with the effect of

It is possible to go to the end and transform it into the form you show within the frame in your question. However, it requires to introduce two new functions that may be somewhat difficult. I will do it if needed.

Have fun!

• Thanks. I am having a lot of fun playing with Mathematica despite being a total beginner at programming. Your answer helped a lot, and I think I want to challenge myself on the next functions, may take some time tho. I'll drop it here if I have more questions! Cheers
– Sue
Mar 24, 2021 at 3:24
• One question, what does # in eq4 refers to?
– Sue
Mar 24, 2021 at 3:28
• This is called the "Pure function". Have a look at Menu/Help/WolframDocumentation/Function. Mar 24, 2021 at 10:33