Iwasawa decomposition for $GL_n(\mathbb{A}_{\mathbb{Q}})$. What does $K$ look like? I am trying to understand the Iwasawa decomposition for  $GL_n(\mathbb{A}_{\mathbb{Q}})$ and $GL_n(\mathbb{Q})$, where $\mathbb{A}_{\mathbb{Q}}$ is the adeles. The statement for the case of adeles reads there exists a maximal compact subgroup $K$ of $GL_n(\mathbb{A}_{\mathbb{Q}})$ such that 
$$
GL_n(\mathbb{A}_{\mathbb{Q}}) = P(\mathbb{A}_{\mathbb{Q}}) K
$$
(Here I am taking $P$ to be the upper triangular matrices).
Could someone please explain to me what does $K$ look like in this case? 
Also what does $P(\mathbb{Q}) \backslash GL_n(\mathbb{Q})$ look like? I would greatly appreciate if someone could explain me both. 
Thank you. 
 A: The standard maximal compact subgroup $K$ of $\mathrm{GL}_n(\mathbb{A}_{\mathbb{Q}})$ is the restricted tensor product of the maximal compact of each local field. In particular, the maximal compact subgroup $K_p$ of $\mathrm{GL}_n(\mathbb{Q}_p)$ is $\mathrm{GL}_n(\mathbb{Z}_p)$, while the maximal compact subgroup $K_{\mathbb{R}}$ of $\mathrm{GL}_n(\mathbb{R})$ is the orthogonal group $\mathrm{O}(n)$. (Over global fields $F$ other than $\mathbb{Q}$, there may be complex archimedean places, in which case $K_{\mathbb{C}} = \mathrm{U}(n)$ for $\mathrm{GL}_n(\mathbb{C})$).
What does this mean? Recall that $\mathrm{GL}_n(\mathbb{A}_{\mathbb{Q}})$ consists of elements $(g_{\mathbb{R}},g_2,g_3,g_5,\ldots)$ with $g_{\mathbb{R}} \in \mathrm{GL}_n(\mathbb{R})$, $g_p \in \mathrm{GL}_n(\mathbb{Q}_p)$, and $g_p \in K_p$ for all but finitely many $p$. Then the maximal compact subgroup $K$ of $\mathrm{GL}_n(\mathbb{A}_{\mathbb{Q}})$ consists of elements $(k_{\mathbb{R}},k_2,k_3,k_5,\ldots)$ with $k_{\mathbb{R}} \in K_{\mathbb{R}} = \mathrm{O}(n)$ and $k_p \in K_p = \mathrm{GL}_n(\mathbb{Z}_p)$.
For your second question, the standard way to understand $P(\mathbb{Q}) \backslash \mathrm{GL}_n(\mathbb{Q})$ is via the Bruhat decomposition. Let $W_n$ denote the Weyl group (of order $n!$) consisting of all $n \times n$ matrices that have precisely one $1$ in each row and each column and zeroes elsewhere. (For example, the identity matrix.) The Bruhat decomposition states that for any field $F$,
$$\mathrm{GL}_n(F) = \bigsqcup_{w \in W_n} P(F) w P(F).$$
Of course, if $w$ is the identity matrix $1_n$, then $P(F) w P(F) = P(F)$. So we observe that
$$P(F) \backslash \mathrm{GL}_n(F) = 1_n \sqcup \bigsqcup_{w \in W_n \setminus \{1_n\}} w P(F).$$
For example, for $n = 2$ and $w = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}$,
$$w P(F) = \left\{\begin{pmatrix} 0 & d \\ a & b \end{pmatrix} \in \mathrm{GL}_2(F)\right\}.$$
