# How to properly attempt to express a function in terms of new variables

I have a specific problem in mind, but I am more interested in how to "properly" convey to Mathematica the result that I want. To start with, I have a function $$G$$ that can be represented like

$$G=f(x_1,y_1)+f(x_2,y_2)$$

and I want to find an expression $$G(x,y)$$ such that

$$x=x_1+x_2\,,\quad y=y_1+y_2$$

I know the form of $$f$$ and I want find $$G(x,y)$$. I know that $$x$$ and $$y$$ (also $$(x_1,y_1)$$ and $$(x_2,y_2)$$) are linearly independent variables.

How can I properly instruct Mathematica to make manipulations to $$G$$ for this purpose? It is possible this cannot be done analytically, and if that is true I would like Mathematica to respond in a way that I can be certain that it cannot be done, or at least that Mathematica cannot accomplish this.

So far I have tried methods involving built in functions like FullSimplify, TrigReduce, TrigExpand, etc., but these functions don't have the same end goal in mind. I have also browsed the stack exchange, but I don't think I have found a satisfactory answer. Essentially what I want is a "proper" way of telling Mathematica the end goal I want so that the result I get is either the function $$G(x,y)$$ or something that indicates failure to find it.

Example:

f[x1_,y1_] := Sinh[2 x1]/(Cosh[2 x1] + Cosh[2 y1])
G = f[x1,y1]+f[x2,y2]


and I am looking for an expression

G[x,y] = G[x1+x2,y1+y2]

• It would be good to have a concrete example in the post, in copy/paste format. Commented Mar 22, 2021 at 19:17

This is not an answer, just a counterexample. In addition to your definition of f[x1,y1], let's define h[x1,x2,y1,y2]

ClearAll[f, h]
f[x1_, y1_] := Sinh[2 x1]/(Cosh[2 x1] + Cosh[2 y1])
h[x1_, x2_, y1_, y2_] := f[x1, y1] + f[x2, y2]


How should one view g[2x,y]? Should it be the same as h[x,x,y,0]?

h[x, x, y, 0]


$$\frac{\sinh (2 x)}{\cosh (2 x)+\cosh (2 y)}+\frac{\sinh (2 x)}{\cosh (2 x)+1}$$

Or, is it h[2x,0,y,0]?

h[2 x, 0, y, 0]


$$\frac{\sinh (4 x)}{\cosh (4 x)+\cosh (2 y)}$$

It seems the $$G(x,y)$$ you are asking for is not well defined for this particular (nonlinear) choice of f[x1,y1].

• I am afraid this doesn't make any sense to me. Should the Identification for G[2x,y] not be just h[2x1,2x2,y1,y2]? Why using 2x would enforce either y2=0 or x2=y2=0 is not clear. Commented Mar 23, 2021 at 15:37
• That's exactly the point I was trying to make -- the first argument of G does not enforce anything on $x_1$ and $x_2$. Maybe you can add a few examples to your question. Can you tell us what the function G[6,2] must evaluate to? It seems like we could use $x_1=3+\lambda$ and $x_2=3-\lambda$, since those values are consistent with $x=x_1+x_2=6$ for any $\lambda$. Can you tell us what to use for $\lambda$ in every case? Commented Mar 23, 2021 at 23:16
• This is a lot more clear to me now, apologies. x and y are linearly independent variables, i.e. that every point in 2D space maps to a unique set (x,y) and changing x does not change y. This means that (x1,x2,y1,y2) cannot just be freely choosen. I do have definitions for the variables in terms of 2D Euclidean coordinates, but I didn't think it was relevant to the core question. For your two examples, any case where x1=0 or x2=0 is undefined and constraining x1=x2 actually requires y=0. Do you think that in order to solve this problem, I require some sort of λ constraint? Commented Mar 24, 2021 at 1:52