Background:
I work for BYU Independent Study variablizing question and a came across this while working with domains of logarithmic functions.
$ f(x) = \ln(a-x) + \ln(x-b) $
In this case, if $ b<a $ then the domain of the function is defined as $ (b, \, a) $. But if $ a<b $ then the function is undefined at each point. However, if we use the product rule of logarithms we get
$ f(x) = \ln(-(x-a)(x-b)) $
which always has a domain defined as $ (a, \, b) $ or $ (b, \, a) $.
In Calculus we can do a similar transformation by simplifying $ g(x) $
$ g(x) = \frac{(x-a)(x-b)}{x-a} = x-b $
In calculus we define the missing point as
$ \lim_{x \rightarrow a} \frac{(x-a)(x-b)}{x-a} = \lim_{x \rightarrow a} (x-b) = a-b $
Question:
So is there a way to justify this "legal" algebraic transformation of the function $ f(x) $ to define the domain at $ (a, \, b) $?
I'm assuming we are dealing with only real numbers.
I think the problem is in this step:
Let's analyze $$\ln(a-x)+\ln(x-b)\tag{$\star$}$$
Because the domain of $\ln x$ is restricted to $(0,\infty)$, the restrictions on $a,b,\text{ and }x$ are:
$$x\le a\tag{1}$$ $$b\le x\tag{2}$$ $$b\le x\le a\implies D_f=[b,a]\tag{3}$$
Rewriting $f(x)$ as $$g(x)=\ln\left((a-x)(x-b)\right)\tag{$\star\star$}x$$ makes some subtle changes and therefore requires very delicate analysis.
Let $A=(a-x), B=(x-b)$. Because $g(x)=\ln AB$, we require that $AB$ be greater than zero . Thus, the restrictions on $A\text{ and }B$ are $A,B>0$ or $A,B<0$. Solving for $a$ and $b$, we have either $a<x<b\tag{$4$}$ or $b<x<a\tag{$5$}$
But both of these cannot be true. If $a<b$, then $(4)$ is true and if $a>b$, $(5)$ is true, but we cannot have $a<b$ and $b<a$.
We can resolve the ambiguity about the domain of $f$ by referring back to $(\star)$, where the domain is $(3)$. Had $f(x)$ been given originally as $(\star\star)$, its domain would be ambiguous until we know whether $a>b$ or $b<a$. However, because $f(x)$ was given specifically as $(\star)$, we know that the correct domain is the one corresponding to $(\star)$, namely $D_f=[b,a]$
I am making a very subtle assumption here – that the domain of variables in an expression is limited to how the expression in its current form restricts the variables (see domain of a function); we dont care about how the expression could be written. Only about how it actually is written. If we cared, I would have made the same conclusions for the domain of $f$ as I did for $g$, because $f$ can be rewritten as $g$ and thus which possibility is the actual domain of $f$ would be ambiguous.
Like you pointed out, a metaphor for this can be two functions $c(x)$ and $l(x)$, given by $$c(x)=\frac{(x+2)}{(x+2)(x-4)}$$ $$l(x)=\frac{1}{(x-4)}$$
We can simplify $c$ as $l$, but must consider the restrictions on $x$ by $l$ which are carried through the simplification. That changing the algebraic structure of an expression makes subtle analytical changes of this form might be a little hard to accept; it is for me as well. I imagine it was originally a convention – but mathematical society made it a rule to keep things consistent and thereby obviate potential problems in more complex situations.