I feel unsure how to phrase this question so I'm going to start with an example of what I'm wondering about.
Say I want to calculate $\int \frac{\sqrt{x-2}}{x-1}dx$. I have been taught one can do so by the variable substitution $y = \sqrt{x-2}$ and the "unproper" algebra $dy/dx = \frac{1}{2\sqrt{x-2}} \iff dx = 2\sqrt{x-2} (dy)$ so that
$\int \frac{\sqrt{x-2}}{x-1}dx = \int \frac{y}{y^2 + 1} 2y (dy) = ...$ and so on
I call the algebra "unproper" because my professor noted that it really is just a sort of a "memory rule" and not real algebraic operations, at least not for my calculus class since thus far $dx, dy...$ has just been used as notation and not mathematical objects.
It is my understanding that what is actually going on during the variable substitution is using the rule
$\int f(g(x))g'(x) = F(g(x)) + C \quad (R1)$
which in the above example would be something like
$g(x) = \sqrt{x-2}$
$g'(x) = \frac{1}{2\sqrt{x-2}}$ so that
$\int \dfrac{\sqrt{x-2}}{x-1}dx = \int \dfrac{g(x)}{g(x)^2+1} dx = \int \left(\dfrac{g(x)}{g(x)^2+1}g'(x)^{-1} \right)g'(x) (dx)$
and from here use $(R1)$. But in the above example the domain of $\dfrac{\sqrt{x-2}}{x-1}$ is $[2, \infty[$ but multiplying with $g'(x)^{-1}g'(x)$ shrinks the domain to $]2, \infty[$ since $\dfrac{1}{2\sqrt{2-2}}$ is not defined because of dividing by zero. Am I correct that the above variable substitution then would be incorrect?
As far as I know, all substitution techniques at least in elementary calculus are based on the chain rule idea. Let's say the function $\frac{\sqrt{x-2}}{x-1}$ has an antiderivative $G(x)$. Then, the following must hold true:
$$\int\frac{\sqrt{x-2}}{x-1}\,dx=G(x)\Longleftrightarrow G'(x)=\frac{\sqrt{x-2}}{x-1}$$
There is nothing stopping us from saying that $x$ is actually itself a function of another variable, say $t$. Then, according to the chain rule, if we kept differentiating the function $G$ with respect to $t$, we should have gotten the following result:
$$G'(x(t))=\frac{\sqrt{x(t)-2}}{x(t)-1}x'(t)$$
The above means that the following must be true:
$$ \int\frac{\sqrt{x(t)-2}}{x(t)-1}x'(t)\,dt=G(x)\Longleftrightarrow G'(x(t))=\frac{\sqrt{x(t)-2}}{x(t)-1}x'(t) $$
Say, $x(t)=t^2+2$, then:
$$\int\frac{\sqrt{x(t)-2}}{x(t)-1}x'(t)\,dt= \int\frac{\sqrt{t^2+2-2}}{t^2+2-1}2t\,dt= 2\int\frac{t^2}{t^2+1}\,dt $$
Now, we have a completely new integral that we can actually integrate. The variable of integration is $t$ and it is a function of $x$: $t(x)=\sqrt{x-2}$. And I see no domain issues here at all.