Let $p>2$, consider the subgroup $Z\mathrm{SL}_2(\mathbb{Q}_p)$ of $\mathrm{GL}_2(\mathbb{Q}_p)$ where $Z\cong\mathbb{Q}_p^\times$ is the centre of $\mathrm{GL}_2(\mathbb{Q}_p)$. Then I'd like to know how to prove that the index of $Z\mathrm{SL}_2(\mathbb{Q}_p)$ in $\mathrm{GL}_2(\mathbb{Q}_p)$ is $4$.
By the determinant map, I know that there is an isomorphism of groups $\mathrm{GL}_2(\mathbb{Q}_p)/\mathrm{SL}_2(\mathbb{Q}_p)\cong\mathbb{Q}_p^\times$. But I do know how to continue.
The motivation is that I want to know the dimension of the induced representation $\mathrm{Ind}_{Z\mathrm{SL}_2(\mathbb{Q}_p)}^{\mathrm{GL}_2(\mathbb{Q}_p)}$ of a character.
As you observe, determinant gives an isomorphism $\mathrm{GL}_2(\mathbb Q_p)/\mathrm{SL}_2(\mathbb Q_p)\simeq\mathbb Q_p^\times$. There is an isomorphism $$\mathrm{GL}_2(\mathbb Q_p)/Z\mathrm{SL}_2(\mathbb Q_p)\simeq\mathbb Q_p^\times/(\mathbb Q_p^\times)^2.$$ There is moreover a short exact sequence $$1\to\mathbb Z_p^\times\to\mathbb Q_p^\times\xrightarrow v\mathbb Z\to 0,$$ which upon tensoring with $\mathbb Z/2$ (since $\mathbb Z$ is free) induces a short exact sequence $$1\to\mathbb Z_p^\times/(\mathbb Z_p^\times)^2\to\mathbb Q_p^\times/(\mathbb Q_p^\times)^2\to\mathbb Z/2\to 0.$$ Since $\mathbb Z_p^\times/(\mathbb Z_p^\times)^2\simeq\mathbb F_p^\times/(\mathbb F_p^\times)^2$ has order $2$ (since $\mathbb F_p^\times$ is cyclic), this shows $\mathbb Q_p^\times/(\mathbb Q_p^\times)^2$ has order $4$, so the index of $Z\mathrm{SL}_2(\mathbb Q_p)\subset \mathrm{GL}_2(\mathbb Q_p)$ is $4$.