# How to ask Mathematica to simplify an expression in terms of a particular variable?

With the following matrix where there are relations between different variables a,b,c,d, how can I instruct Mathematica to yield the answer only in terms of variables a and X

    d/(2 b) == X; (b + c)/(2b) == X; (e - b)/(2b) == X;

mat = FullSimplify[{{a - I ((b + c)/2), d}, {d, a - I ((e - b)/2)}}]


ClearAll["Global*"]


Since there are only three equations for the relations, you can only eliminate three variables. In addition to a and X, e will also remain.

repl = Solve[{d/(2 b) == X, (b + c)/(2 b) == X, (e - b)/(2 b) == X},
{b, c, d}][[1]]

(* {b -> e/(1 + 2 X), c -> (e (-1 + 2 X))/(1 + 2 X), d -> (2 e X)/(1 + 2 X)} *)

mat = {{a - I ((b + c)/2), d}, {d, a - I ((e - b)/2)}} /. repl // Simplify

(* {{(a + 2 a X - I e X)/(1 + 2 X), (2 e X)/(1 + 2 X)}, {(2 e X)/(1 + 2 X),
(a + 2 a X - I e X)/(1 + 2 X)}} *)
`