Can general wavefunctions be expressed as kets? I am confused on bra-ket notation in quantum mechanics. My professor says that a ket is an eigenfunction of some operator. However, for some time now I thought a ket could represent a general wavefunction. Obviously any wavefunction should be able to be expressed as a linear combination of eigenfunctions (and thus a linear combination of kets based on my professor's definition), but I've always thought that a ket could represent any wavefunction, not just an eigenfunction. Which of these two viewpoints is right, or, if they are both right, how are they both right?
 A: Actually, what your professor isn't telling you - what we always gloss over in intro quantum mechanics for simplicity, but I might as well give it away now because everything will make so much more sense once you get this - is that kets aren't wavefunctions at all.
Forget that you ever learned about wavefunctions for a minute.
Kets are a form of notation for representing quantum states. (Any quantum states. Technically this answers your question, but you may want to read on.) Basically, whatever sort of thing it is that specifies the behavior of a quantum system, we call it a quantum state, and write it as the ket $\lvert\psi\rangle$, where $\psi$ is some label that we can choose for our convenience. (So $\lvert 1\rangle$, $\lvert 2\rangle$, $\lvert\alpha\rangle$, etc., they're all just arbitrary labels, and you don't know anything about them except that they're different, $\lvert 1\rangle\neq\lvert 2\rangle$ and so on.) Then we assume that these abstract objects, the quantum states, have all the properties needed to make them members of a vector space: they can be added, multiplied by scalars, you can take inner products of them, and so on. Thus we can meaningfully write things like $\frac{1}{\sqrt{2}}\lvert\text{bob}\rangle - \frac{1}{\sqrt{2}}\lvert\text{sally}\rangle$, or $\langle\text{steve}\lvert\text{cookies}\rangle$.
Now, since these kets represent states of quantum systems, we should be able to relate the properties of those quantum systems to the kets. For example, suppose you have some system, maybe an electron in a box. This electron has some state, which we'll denote $\lvert\psi\rangle$. It's reasonable to ask, what is the probability of finding the electron in a certain tiny volume $\mathrm{d}^3 V$ at position $\mathbf{a}$? This probability, which I'll denote $P(\mathbf{a})\,\mathrm{d}^3 V$, should be computable from the quantum state, so there should be some procedure by which we can start with $\lvert\psi\rangle$ and get $P(\mathbf{a})\,\mathrm{d}^3 V$.
Of course, there is such a procedure. It requires the use of a particular ket, which I'll denote $\lvert\mathbf{a}\rangle$, and through arguments which I won't go into here you can determine that the ket $\lvert\mathbf{a}\rangle$ corresponds to the quantum state of a particle which is known to be at the position $\mathbf{a}$. With that definition out of the way, the procedure is
$$P(\mathbf{a})\,\mathrm{d}^3 V = \langle\psi\lvert\mathbf{a}\rangle\langle\mathbf{a}\rvert\psi\rangle\mathrm{d}^3 V$$
This quantity $\langle\mathbf{a}\rvert\psi\rangle$ is just a number - even though we may not really know what $\lvert\psi\rangle$ or $\lvert\mathbf{a}\rangle$ are, we know that their inner product is a number, because that's what an inner product does, it produces a number out of two elements of a vector space.
You can pick a different position in the box, $\mathbf{b}$, and go through the same procedure, obtaining
$$P(\mathbf{b})\,\mathrm{d}^3 V = \langle\psi\lvert\mathbf{b}\rangle\langle\mathbf{b}\rvert\psi\rangle\mathrm{d}^3 V$$
where $\langle\mathbf{b}\rvert\psi\rangle$ is, again, a number - probably a different one.
Then you can go on and do this for all the other positions in the box. For every position $\mathbf{r}$, there is some associated "localized" ket $\lvert\mathbf{r}\rangle$, and then you can take this ket and combine it with $\lvert\psi\rangle$ to get the number $\langle\mathbf{r}\rvert\psi\rangle$. Essentially, what you're doing here is constructing a mapping of positions to numbers.
This mapping is the wavefunction.
$$\psi(\mathbf{r}) = \langle\mathbf{r}\rvert\psi\rangle$$
Of course, your question is really about the reverse process: given a wavefunction, is there always necessarily a ket (a quantum state) that corresponds to it? There is, and you can see it by making an analogy to regular vectors. If you have some vector $\vec{v} = a\hat{x} + b\hat{y} + c\hat{z}$, you can extract the $x$ component by computing $\hat{x}\cdot\vec{v}$. That will give you $a$. Then you can get back to the original vector by multiplying each component by its corresponding unit vector and adding them all up:
$$(\hat{x}\cdot\vec{v})\hat{x} + (\hat{y}\cdot\vec{v})\hat{y} + (\hat{z}\cdot\vec{v})\hat{z} = a\hat{x} + b\hat{y} + c\hat{z} = \vec{v}$$
But extracting a component is exactly what we were doing with $\lvert\mathbf{a}\rangle$ and $\lvert\mathbf{b}\rangle$ and so on. See, the vector space in which $\lvert\psi\rangle$ lives is an infinite-dimensional vector space, with one basis vector associated with each point in real space. So something like $\langle\mathbf{a}\lvert\psi\rangle$ is the component of $\lvert\psi\rangle$ corresponding to the unit vector $\lvert\mathbf{a}\rangle$. Accordingly, if you want to reconstruct $\lvert\psi\rangle$ from the components, you have to multiply each component by its unit vector,
$$\langle\mathbf{r}\lvert\psi\rangle\lvert\mathbf{r}\rangle$$
and add them up - or since there are an infinite number in this case, you integrate:
$$\int\lvert\mathbf{r}\rangle\langle\mathbf{r}\lvert\psi\rangle\mathrm{d}^3 V = \lvert\psi\rangle$$
In this way, given any wavefunction $\psi(\mathbf{r})$ and the basis states $\lvert\mathbf{r}\rangle$, you can turn it into a quantum state. (Assuming there is no additional information encoded in the quantum state. That's something to think about later, when you learn about spin.)
