# Using Reduce to simplify (not solve) system of equations

I'm dealing with a Mathematica program that generates a set of coupled non-linear equations involving an unknown function and its derivatives with respect to at least one independent variable. My goal is to simplify this system of equations as much as possible, without solving it explicitly, and present it in the most concise form possible.

I attempted to employ the Reduce function, but it returned an error stating, "This system cannot be solved with the methods available to Reduce". I don't anticipate Reduce to provide a solution, but rather to simplify the system as much as possible (by, e.g., identifying terms that simplify to zero, removing linearly dependent equations, etc.). Additionally, using FullSimplify on a system of equations seems only to simplify each equation individually and not the system as a whole.

Q.: Could someone guide me on how to achieve the maximum possible simplification of a system of equations without attempting to solve it?

In a specific application, I'm utilizing xCoba, a Mathematica package based on the xAct suite for tensor manipulation, to compute the Einstein Field Equations from a given metric. For my particular case, and to provide an illustrative example, two equations from the system are:

$$\text{f}^{(2,0)}(r,\theta ) \left(a^2 \cos ^2(\theta)+r^2\right)+\frac{4 a^2 \cos ^2(\theta ) \text{f}(r,\theta)}{a^2 \cos ^2(\theta )+r^2}+2 r \text{f}^{(1,0)}(r,\theta )=0 \tag{1}$$

$$\text{f}(r,\theta ) \left(2 \text{f}^{(2,0)}(r,\theta )\left(a^2 \cos ^2(\theta )+r^2\right)+\frac{8 a^2 \cos ^2(\theta) \text{f}(r,\theta )}{a^2 \cos ^2(\theta )+r^2}+4 r \text{f}^{(1,0)}(r,\theta )\right)=2 \left(\left(a^2+r^2\right) \text{f}^{(2,0)}(r,\theta)+\text{f}^{(0,2)}(r,\theta )+2 r \text{f}^{(1,0)}(r,\theta )+\cot (\theta )\text{f}^{(0,1)}(r,\theta )\right) \tag{2}$$

Even though the system appears complex, it is clear that one can use Equation (1) to simplify the left-hand side of Equation (2). However, attempting to use Reduce on this system of equations have been unsuccessful. Here is such a MWE:

Reduce[
{
(4 a^2 Cos[\[Theta]]^2 f[r, \[Theta]])/(a^2 Cos[\[Theta]]^2 +
r^2) + 2 r D[
f[r, \[Theta]], {r, 1}] + (a^2 Cos[\[Theta]]^2 + r^2) D[
f[r, \[Theta]], {r, 2}] == 0,
f[r, \[Theta]] ((8 a^2 Cos[\[Theta]]^2 f[
r, \[Theta]])/(a^2 Cos[\[Theta]]^2 + r^2) +
4 r D[f[r, \[Theta]], {r, 1}] +
2 (a^2 Cos[\[Theta]]^2 + r^2) D[f[r, \[Theta]], {r, 2}]) ==
2 (Cot[\[Theta]] D[f[r, \[Theta]], {\[Theta], 1}] +
D[f[r, \[Theta]], {\[Theta], 2}] +
2 r D[f[r, \[Theta]], {r, 1}] + (a^2 + r^2) D[
f[r, \[Theta]], {r, 2}])
}
]

• I've added a MWE of the LaTeX code I have provided as an edit given that it is too long to paste as a comment. Hopefully no mistake has been made in copying/pasting it. I think the code itself is not very relevant, as I intend to use this for very different systems of equations, and I was looking for a general feature of Mathematica that will always reduce me a given system to its most concise and compact form possible (here possible is the keyword). Nov 30, 2023 at 12:04

There is one method, where Simplify is given two arguments, which might accomplish what you want in some cases.

Simplify[ComplicatedContainingLargeInSomePerhapsPartlyHiddenForm,Large==Small]


will go to considerable effort trying to identify and rearrange and transform portions of your Complicated that include Large and then replace those with Small. Note that this will not work if you want replace something Small with something Bigger.

Simplify[f[r,\[Theta]] ((8 a^2 Cos[\[Theta]]^2 f[r,\[Theta]])/(a^2 Cos[\[Theta]]^2+r^2)+
4 r D[f[r,\[Theta]], {r,1}] + 2 (a^2 Cos[\[Theta]]^2 + r^2) D[f[r,\[Theta]],{r,2}])==
2 (Cot[\[Theta]] D[f[r, \[Theta]], {\[Theta], 1}] + D[f[r, \[Theta]], {\[Theta], 2}] +
2 r D[f[r, \[Theta]], {r, 1}] + (a^2 + r^2)*D[f[r, \[Theta]],{r,2}]),
(4 a^2 Cos[\[Theta]]^2 f[r,\[Theta]])/(a^2 Cos[\[Theta]]^2+r^2)+
2 r D[f[r,\[Theta]],{r,1}]+(a^2 Cos[\[Theta]]^2+r^2)*D[f[r,\[Theta]],{r,2}]==0
]


instantly identifies your first equation in your second and replaces it, returning

2*(Cot[\[Theta]]*D[f[r, \[Theta]], {\[Theta], 1}] + D[f[r, \[Theta]], {\[Theta], 2}] +
2*r*D[f[r, \[Theta]], {r, 1}] + (a^2 + r^2)*D[f[r, \[Theta]], {r, 2}]) == 0


And that will not, in most cases, try to solve your system for you, but it may at times perform simplifications that you may not desire.

See if this will accomplish what you want.

Please check this very carefully to try to make certain that I've made no mistakes.

• For a list of two equations (eqns), Simplify @@ ReverseSortBy[eqns, LeafCount] Nov 30, 2023 at 13:58
• Thanks, I would like to follow up on your answer with two questions. 1) Is it possible to extend the number of arguments to be larger than two, without compromising on the operations Mathematica can do in order to simplify the system of equations, as in general I will be dealing with more than two equations. 2) How does your answer compare to the one provided by Bob Hanlon in the comment above? They seem to achieve similar results so I imagine it to be some short-hand syntax. Nov 30, 2023 at 14:42
• For more than two equations, perhaps Simplify[Most[#], Last[#]] & @@ ReverseSortBy[eqns, LeafCount] However, depending on the specific equations, something else may be required. Nov 30, 2023 at 15:12
• I'm trying to dissect your piece of code but failing. For my system of equations, not the one that I have presented before but rather the full set, I get an error from Simplify stating that 0 is not a well-formed assumption and it outputs True. Nov 30, 2023 at 15:19
• Without seeing the equations it is difficult to say, but your last equation appears to be 0. Note that comments need to be addressed (e.g., @BobHanlon) for others to be notified. Post a minimal example that demonstrates the problem Nov 30, 2023 at 16:11