Suppose, I have some operator $\hat{A}$, such that in the $x$-basis, it is written as $f(x).$ I'm trying to calculate the expectation value of this operator in integral form. That is given by the following expression :
$$\langle\hat{A}\rangle = \int\psi^*(x)f(x)\psi(x)dx$$
We have assumed that the wave function is normalized here.
In this case, we have done the entire integral in the $x$-basis. I suppose, we can actually write the above integral as : $$\langle\hat{A}\rangle = \int\langle \psi|x\rangle\langle x|\hat{A}|x\rangle\langle x|\psi\rangle dx$$
However, suppose my wave function evolves and becomes $\psi(u)$, where $u=g(x)$. We can try to find the expectation value of this new wave function. We know : $$\langle\hat{A}\rangle = \frac{\int\psi^*(u)f(x)\psi(u)dx}{\int\psi^*(u)\psi(u)dx}$$
However, we need to change the variable of integration to $u$, and so we do the following:
$$\langle\hat{A}\rangle = \frac{\int\psi^*(u)f\space o\space g^{-1}(u)\psi(u)\frac{du}{g' \space o \space g^{-1}(u)}}{\int\psi^*(u)\psi(u)\frac{du}{g' \space o \space g^{-1}(u)}}$$
Now we can evaluate the integral, as everything is in the $u$ basis.
However, what we did here is first write the integral in the $x$ basis, and then use suitable transformations to make $u$ the variable of integration. However, how can I write the integral directly in the $u$ basis.
For example, we know: $$\langle\hat{A}\rangle=\frac{\langle\psi|\hat{A}|\psi\rangle}{\langle\psi|\psi\rangle}$$
I suppose we can insert any basis here in the following way:
$$\langle\hat{A}\rangle=\frac{\langle\psi|x\rangle\langle x|\hat{A}|x\rangle\langle x|\psi\rangle}{\langle\psi|x\rangle\langle x|\psi\rangle}=\frac{\langle\psi|u\rangle\langle u|\hat{A}|u\rangle\langle u|\psi\rangle}{\langle\psi|u\rangle\langle u|\psi\rangle}$$
Moreover, $$\frac{\langle\psi|x\rangle\langle x|\hat{A}|x\rangle\langle x|\psi\rangle}{\langle\psi|x\rangle\langle x|\psi\rangle}=\int\psi^*(x)f(x)\psi(x)dx$$
Hence, we must have :
$$\frac{\langle\psi|u\rangle\langle u|\hat{A}|u\rangle\langle u|\psi\rangle}{\langle\psi|u\rangle\langle u|\psi\rangle}=\frac{\int\psi^*(u)f\space o\space g^{-1}(u)\psi(u)\frac{du}{g' \space o \space g^{-1}(u)}}{\int\psi^*(u)\psi(u)\frac{du}{g' \space o \space g^{-1}(u)}}$$
Now I can see that $f(x)$ is replaced by $f\space o\space g^{-1}(u)$, as this is the representation of the operator in the $u$ basis. However there is also a $g'\space o \space g^{-1}(u)$ term below the differential $du$.
My question is, where is this factor coming from ? How do we formulate the entire thing using dirac notation ? I know the initial equation in terms of the $x$ basis, and so I use the transformations to convert the integral into the $u$ basis. This can be shown as :
$$\langle \hat{A}\rangle=\frac{\int\psi^*(g(x))f(x)\psi(g(x))dx}{\int\psi^*(g(x))\psi(g(x))dx}=\frac{\int\psi^*(u)f\space o\space g^{-1}(u)\psi(u)\frac{du}{g' \space o \space g^{-1}(u)}}{\int\psi^*(u)\psi(u)\frac{du}{g' \space o \space g^{-1}(u)}}$$
Using Bra-Ket notation, I can write the integral in $x$ basis, and then transform it into the $u$ basis. However, I don't see how to write the integral directly in the $u$ basis, using Bra-ket notation. It is clear to me, how the expression of the operator changes in the Bra-ket notation, in the new basis. However, it is unclear to me where the factor under the differential comes from, if we try to write the integral directly using Bra-Ket notation.
I hope I've been able to explain my confusion. Any help would be highly appreciated.
EDIT:
My initial intuition is that the term under the differential $du$ is the weight factor of the integral. However, I have no idea how it is represented in Dirac notation. For example, in the $x$ basis, the weight factor is clearly $1$ as there is nothing under the differential $dx$. Where does this come from in Dirac notation to integral notation conversion?