We can use CoefficientArrays
to get coefficient matrix of the system:
eqs = 2 a*c + 2 d*fr + 2 b*er + 2 gi hi + 2 gr hr == 0 &&
2 a*d + 2 c*fr + 2 b*gr + 2 (ei hi + er hr) == 0 &&
2 a*b + 2 c*er + 2 d*gr + 2 (fi hi + fr hr) ==
0 && (2 d*fi + 2 b*ei) + 2 gr*hi - 2 gi*hr ==
0 && (2 c*fi + 2 b*gi) + 2 er hi - 2 ei hr ==
0 && (2 c*ei + 2 d*gi) + 2 fr hi - 2 fi hr == 0;
vars = {er, ei, fr, fi, gr, gi};
consts = {a, b, c, d, hi, hr};
eqs = List @@ eqs;
{vec, mat} = CoefficientArrays[eqs, vars] // Normal;
And now LinearSolve
:
varSolns = LinearSolve[mat, -vec]//FullSimplify
(*
{(a (2 b c (d - hi) (d + hi) (b^2 + c^2 - d^2 - hi^2) +
d ((b^2 - c^2)^2 - (d^2 - hi^2)^2) hr -
2 b c (b^2 + c^2 - 2 hi^2) hr^2 + 2 d (d - hi) (d + hi) hr^3 +
2 b c hr^4 - d hr^5))/(
b^4 (hi^2 + hr^2) + (c^2 + d^2 - hi^2 - hr^2)^2 (hi^2 + hr^2) +
2 b^2 ((d^2 - hi^2 - hr^2) (hi^2 + hr^2) +
c^2 (-2 d^2 + hi^2 + hr^2))), -((
a d hi (-(b^2 - c^2)^2 + (-d^2 + hi^2 + hr^2)^2))/(
b^4 (hi^2 + hr^2) + (c^2 + d^2 - hi^2 - hr^2)^2 (hi^2 + hr^2) +
2 b^2 ((d^2 - hi^2 - hr^2) (hi^2 + hr^2) +
c^2 (-2 d^2 + hi^2 + hr^2)))), (
a (-2 b^4 c d + 2 b^2 c d (c^2 + d^2) - b^5 hr +
b (c^2 - d^2)^2 hr + 2 b^3 hr (hi^2 + hr^2) -
2 c d (c^2 + d^2 - hi^2 - hr^2) (hi^2 + hr^2) -
b hr (hi^2 + hr^2)^2))/(
b^4 (hi^2 + hr^2) + (c^2 + d^2 - hi^2 - hr^2)^2 (hi^2 + hr^2) +
2 b^2 ((d^2 - hi^2 - hr^2) (hi^2 + hr^2) +
c^2 (-2 d^2 + hi^2 + hr^2))), -((
a b hi (b^2 + c^2 - d^2 - hi^2 - hr^2) (b^2 - c^2 + d^2 - hi^2 -
hr^2))/(b^4 (hi^2 + hr^2) + (c^2 + d^2 - hi^2 - hr^2)^2 (hi^2 +
hr^2) + 2 b^2 ((d^2 - hi^2 - hr^2) (hi^2 + hr^2) +
c^2 (-2 d^2 + hi^2 + hr^2)))), (
a (b^4 c hr - 2 b^2 c d^2 hr + c d^4 hr +
2 b^3 d (c^2 - hi^2 - hr^2) - c hr (-c^2 + hi^2 + hr^2)^2 -
2 b d (c^2 - hi^2 - hr^2) (c^2 - d^2 + hi^2 + hr^2)))/(
b^4 (hi^2 + hr^2) + (c^2 + d^2 - hi^2 - hr^2)^2 (hi^2 + hr^2) +
2 b^2 ((d^2 - hi^2 - hr^2) (hi^2 + hr^2) +
c^2 (-2 d^2 + hi^2 + hr^2))), (
a c hi (b^2 + c^2 - d^2 - hi^2 - hr^2) (b^2 - c^2 - d^2 + hi^2 +
hr^2))/(b^4 (hi^2 + hr^2) + (c^2 + d^2 - hi^2 - hr^2)^2 (hi^2 +
hr^2) + 2 b^2 ((d^2 - hi^2 - hr^2) (hi^2 + hr^2) +
c^2 (-2 d^2 + hi^2 + hr^2)))}
*)
And confirm the solution (pretty much everything after this is the same as in @BobHanlon's answer):
ruleSolns = Thread[vars -> varSolns];
Simplify[eqs /. ruleSolns]
(* {True, True, True, True, True, True} *)
We can then combine the FunctionDomain
s of each solution over the reals with respect to constants const
to find where the solution is defined:
Simplify[And @@ (FunctionDomain[#, consts, Reals] & /@ varSolns)]
(*
(hi^2 + hr^2) (b^4 + (c^2 + d^2 - hi^2 - hr^2)^2) ≠
2 b^2 (c^2 (2 d^2 - hi^2 - hr^2) - (d^2 - hi^2 - hr^2) (hi^2 + hr^2))
*)
Also, note that mat
has a trivial NullSpace
so the solutions are unique:
NullSpace[mat]
(* {} *)