Explanation of "weight function" of inner product in Hilbert space I am a physicist so I am sorry if the following is not written in a rigorous (or even completely right) way.
As Quantum Mechanics is formed in Hilbert space, I would like to know what the so-called weight function $w(t)$ stands for, which is defined via the inner product:
$$
 \langle f, g \rangle = \int_0^1 f(t) \overline{g(t)} w(t) \,\text{d}t.
$$
In vectors in finite dimensions, the inner product does not need something analogous to this, it is just the sum of the multiplication of the components of the vectors in each "direction", so why do we need this in infinite dimensions? What is the use of it? And, most importantly  ,when do we need to have w(t) not equal to 1?
I am only at my second year, so I don't know a lot of mathematics, so a fairly simple but intuitive explanation would be ideal. I would appreciate it if you could connect the explanation with vectors in finite dimensions as I know a fair amount of undergraduate linear algebra, so I can visualize or create useful analogies.
 A: If you provide more context regarding where you have met a weight function in Quantum Mechanics, someone might comment about the physical meaning.
For motivation, recall that even on a finite dimensional vector space, there are many different possible inner products on a single vector space - not only the standard one. A choice of an inner product on a vector space $V$ defines the lengths of vectors and the (cosine of) angles between two vectors and there are infinitely many possible choices each determining a different orthonormal basis for $V$.
Consider the following simple model: instead of thinking of vectors in $\mathbb{C}^n$ as tuples of $n$ complex numbers, think about them as functions from the finite set $\{1, \ldots, n \}$ to $\mathbb{C}$ so elements of $\mathbb{C}^n$ are identified with functions $f \colon \{ 1, \ldots, n \} \rightarrow \mathbb{C}$. Then, the standard inner product on $\mathbb{C}^n$ is written as
$$ \left< f, g \right> = \sum_{i=1}^n f(i) \overline{g(i)}. $$
If we are given a "weight" function $w \colon \{ 1, \ldots, n \} \rightarrow \mathbb{R}_{> 0}$, we can define a new inner product
$$ \left< f, g \right>_w := \sum_{i=1}^n f(i) \overline{g(i)} w(i). $$
Denote by $e_i$ the standard basis vectors of $\mathbb{C}^n$. Measured using the standard inner product, the vectors $(e_i)$ form an orthonormal basis for $\mathbb{C}^n$. Measured using the alternative inner product $\left< \cdot, \cdot \right>_w$, the vectors $(e_i)$ are still orthogonal but not orthonormal anymore - the length of each $e_i$ is $\sqrt{\left< e_i, e_i \right>_w} = \frac{1}{\sqrt{w_i}}$.
Sometimes, the freedom in choosing some convenient inner product on $V$ is useful. Let's assume that you have some linear operator $T \colon V \rightarrow V$. If we could choose some inner product on $V$ (not necessarily the "standard" one, if there is some notion of "standard" for $V$) with respect to which $T$ would be self adjoint, we can apply the spectral theorem and deduce that $T$ is orthogonally diagonalizable (with respect to the chosen inner product). Modulo some technicalities, this precisely what happens in infinite dimensional setting for the the Sturm-Liouville equation in which you have a second order differential eigenvalue problem you want to solve and under a choice of an inner product with a weight function, the relevant operator becomes self-adjoint and you can apply general results about self-adjoint operators to deduce the existence of an orthonormal basis of eigenvectors.
