TITLE: Image of a Galois representation
QUESTION [6 upvotes]: Notation:

$E$ is a non-CM Elliptic curve over $\mathbb{Q}$.
$p$ is an ordinary prime.
$f$ - cuspidal eigenform of weight $k$ = 2  attached with $E$.
$\rho_f$ - the global 2-dimensional $p$-adic Galois representation attached with $f$. 
$\rho_f$ : $G_S$ $\rightarrow$ $\mathrm{GL}_2({\mathbb{Z}}_p)$.
$G_S:= \mathrm{Gal}(\mathbb{Q}_S/{\mathbb{Q}})$, where $\mathbb{Q}_S$ - maximal unramified extension outside the set
$S=\{\text{ bad primes of } E \}  \cup\{ p, \infty \}$.

Assume that the residual representation $\overline{\rho}_f$ is $p$-split. 
The prime $p$ is an ordinary prime. So the the image of $\rho_f$ restricted to the decomposition group $G_p:=\mathrm{Gal}(\overline{\mathbb{Q}_p}/\mathbb{Q}_p)$ will be of the form  $\rho_f$ $\mid$ $G_p$ $\sim$ 
$\begin{pmatrix} a & * \\ 0
& d \end{pmatrix}$. The residual representation $\overline{\rho}_f$ is $p$-split. So,  $\overline{\rho}_f$ $\sim$ 
$\begin{pmatrix} \omega \lambda_p^{-1}(\overline{a}_p) & 0 \\ 0
& \lambda_p(\overline{a}_p)
\end{pmatrix}$, where $\lambda_p$ is an unramified character which sends $\mathrm{Frob}_p$ to $\overline{a}_p$, $\overline{a}_p \in \mathbb{F}_p$ is the mod $p$ reduction of the
$p$-th coefficent $a_p$ of $f$, and $\omega$
is the $p$-adic cyclotomic character.

Question: What is the image of the representation $\rho_f: G_p \rightarrow \mathrm{GL}_2(\mathbb{Z}/p^n \mathbb{Z})$,
  where  $(\mathbb{Z}/p^n\mathbb{Z})^2 \simeq (E[p^n])$, the $p^n$-torsion points of $E$, 
  for some fixed $n \geq 2$? Is it possible to compute it (or atleast it's order) by using MAGMA/SAGE/PARI?

REPLY [2 votes]: One can say something about the image of $\rho_f|G_p$ by checking if $f$ has a companion form mod $p^n$. This can be explicitly done because one knows what the weight of this companion (if it exists) should be ($p^{n-1}(p-1)$, since $k=2$) and the conguences mod $p^n$ that the form's Fourier coefficients must satisfy  vis a vis the $a_p$'s. One need only check that these congruences are satisfied up to the Sturm bound to conclude that the companion exists. If a companion mod $p^n$ exists then $\rho_f|G_p$ mod $p^n$ splits and $p^n$ won't divide the order of its image, else it will.