Theory of ultracold quantum systems