Suppose I have a set of functions $g=g(x)$, that form a basis in the Hilbert Space. I can define states $|g\rangle$ associated with this basis.
Suppose I have some integral in the $x$ basis. I can normally use change of variables or $u$ substitution to convert this integral such that $g=g(x)$ becomes the dependent variable. However, instead of using $u$ substitution, I want to see this transformation directly in the Dirac notation.
For example, say we have an operator $\hat{A}$, such that $\hat{A}|x\rangle=A(x)|x\rangle$, in the $x$ basis. Moreover, we have $\hat{1}=\int dx |x\rangle\langle x|$.
We also know that $\langle x|x'\rangle=\delta(x-x')$.
Using this, we can easily convert from Dirac notation to an integral, when we want to find some expectation value. For example :
$$\langle\hat{A}\rangle = \frac{\langle\psi|\hat{A}|\psi\rangle}{\langle\psi|\psi\rangle}= \frac{\langle\psi|\hat{1}\hat{A}\hat{1}|\psi\rangle}{\langle\psi|\hat{1}\psi\rangle} = \frac{\int dx'\int dx\langle\psi|x\rangle\langle x|\hat{A}|x'\rangle\langle x'|\psi\rangle}{\int dx\langle\psi|x\rangle\langle x|\psi\rangle} = \frac{\int dx'\int dx \psi^*(x)A(x')\delta(x-x')\psi(x')}{\int dx \psi^*(x)\psi(x)}= \frac{\int dx \psi^*(x)A(x)\psi(x)}{\int dx\psi^*(x)\psi(x)}$$
This is how we calculate the expectation value as an integral.
However, let us now try to repeat the procedure for the $|g\rangle$ basis.
The first problem is $\hat{1} \ne \int dg |g\rangle\langle g|$ as these are not normalized. This is mentioned in this answer. So, I would rather write something like $\hat{1} = \int dg \space h(g) |g\rangle\langle g|$. Here $h(g)$ can be thought of some sort of weight or measure.
However, the second problem is I don't know what is $\langle g|g'\rangle = \space ?$
However, I do know that $\hat{A}|g\rangle = F(g)|g\rangle$. It is represented by a different function here in this new basis.
$$\langle\hat{A}\rangle = \frac{\langle\psi|\hat{A}|\psi\rangle}{\langle\psi|\psi\rangle}= \frac{\langle\psi|\hat{1}\hat{A}\hat{1}|\psi\rangle}{\langle\psi|\hat{1}\psi\rangle} = \frac{\int dg'\int dg \space h(g) h(g')\langle\psi|g\rangle\langle g|\hat{A}|g'\rangle\langle g'|\psi\rangle}{\int dg\space h(g)\langle\psi|g\rangle\langle g|\psi\rangle} = \frac{\int dg'\int dg\space h(g)h(g') \psi^*(g)F(g')\langle g|g'\rangle\psi(g')}{\int dg \space h(g)\psi^*(g)\psi(g)}=\space ?$$
I cannot proceed further as I don't know what $\langle g|g'\rangle$ is.
My intuition is, we remember $\hat{1} = \int dg\space h(g)|g\rangle\langle g|$. Hence we can normalize $|g\rangle$, by setting $|g\rangle \rightarrow \frac{|g\rangle}{\sqrt{h(g)}}$.
In that case, I may set $\langle g|g'\rangle = \frac{1}{h(g)}\delta(g-g')$. However, I don't know if this is correct in any way or not. I would also want to know how to prove this to be true, in case this is correct.
Moreover, I also notice that the function $h(g)$ which acts as some sort of a measure or weight factor in the resolution of identity on the new basis, is nothing more than the jacobian, that we would obtain from the $u$ substitution method. Hence, we can say, since $g=g(x)$, the jacobian is just $h(g)=\frac{1}{g'(x)}$.
In the numerator, there are two $h(g)$ terms, and as they represent the jacobian, I need one of them to cancel out. So I am inclined to believe that $\langle g|g'\rangle = \frac{1}{h(g)}\delta(g-g')$ is correct, as this would do just that.
However, I'm not sure if this is mathematically rigorous or even correct. If not, can someone show me the proper way of doing this? This question is a follow-up from the comments to the answer of this question.
How can I represent $u$ substitution directly using Dirac notation? I believe I am almost doing it correct, but then again, I might be horribly wrong and would appreciate any help.
I know that the final answer in the $g$ basis, should be equal to the following :
$$\space ?\space = \frac{\int dg \space h(g) \psi^*(g)F(g)\psi(g)}{\int dg \space h(g)\psi^*(g)\psi(g)}$$
Here $F(g)$ is the representation of operator $\hat{A}$ in the $g$ basis, and $h(g)$ is nothing but the Jacobian, that arises out of change of variables.
However, I want to know how to get to this form directly using Dirac notation, and not $u$ substitution, even thought the latter is much simpler.