How do I find condition on $f$? Find the necessary and sufficient conditions for $f \in L^2(U)$ so that the equation
$-\sum_{i,j=1}^n (a^{ij}u_{x_i})_{x_j}-7u=f$ in $U$ and $u=0$ on $\partial U$.
has a weak solution $u \in H_{0}^1(U)$. Here the matrix $a^{ij}$ is symmetric, bounded, and uniformly elliptic.
I tried to solve this question by solving the bilinear form and Lax Milgram theorem but not able to reach the conclusion. Anyone can suggest some hints?
 A: First of all stating that $u = 0$ on $\partial U$ and stating that a solution has to lie in $H_0^1(U)$ is superfluous (you could either remover the first or state $u \in H^1(U)$). It does not really matter, just a small remark.
Second, I will assume that $\partial U$ is (piecewise) Lipschitz/smooth enough that we can use integration by parts.
Then, the bilinear form corresponding to this PDE is equal to
$$
B: H_1^0(U) \times H_1^0(U) \rightarrow \mathbb{R}; \quad B[u,v] = \int_U (\nabla u)^TA (\nabla v) - 7 u^2,
$$
where $(A)_{ij} = a_{ij}$.
Ignoring this $7$ for a moment we would have $B[u,u] \geq \theta  \left \lVert  u \right \rVert_{H^1(U)}$ (where $\theta$ is the constant from the uniform ellipticity) and we could use Lax-Milgram (even just Riesz representation Theorem as the bilinear form is symmetric). So we would have an answer, any $f$ suffices.
However, due to the $-7u^2$ term we are in a tougher situation.
Then the trick I know comes from Evans' book on PDE.
In particular, in Evans' PDE book he uses the Fredholm alternative for compact operators to answer this question:
$Lu = f $ has a (unique) solution for every $f \in L^2(U)$ if and only if $\langle f, v \rangle_{L^2(U)} = 0$ for all $v \in H_0^1(U)$ such that $Lu = 0$ (This is the second existence theorem, Theorem 4 of $\S$ 6.2.3 in my version, where I used that your A is symmetric).
In other words, when $f \perp Ker(\tilde{B}^*) = Ker(\tilde{B})$, where $\tilde{B}:H_0^1(U) \rightarrow (H_0^1(U))^*; u \mapsto B[u,\cdot]$ is the 'weak version of L'.
This is not a very explicit condition of $f$ since it is just a slight rearrangement of the statment that $f \in ran(\tilde{B})$ together with the usual theorem from functional analysis that $ran(A)^\perp = ker(A^*)$ for a bounded linear operator and the fact that $\tilde{B}$ has closed range, and $\tilde{B}$ is symmetric.
A different view of the above can be found using spectral theory.
Notice that $ker(\tilde{B}) = \{0\}$ if and only if $0$ is not an element of the spectrum of the function $\tilde{B}$ i.e. if 7 is not an eigenvalue of the function
$$
H_0^1(U) \ni \, u \mapsto \int_u (\nabla u)^T A(\nabla \cdot) \, \in (H_0^1(u))^*
$$
but this condition would, again, imply that there is no condition necessary for $f$ to lie in the range (i.e. $\tilde{B}$ would be surjective).
My intuition would be that, to describe $ran(\tilde{B})$ (i.e. by explicitely describing $ker(\tilde{B})$), we would need some more information of $B$ so, as daw mentioned in his comment, some more info on the a_{ij}. But there may be some other explicit characterizations of $ker(\tilde{B})$ or $ran(\tilde{B})$ that work in general (for example, possibly using harnack's inequality, that $u \in ker{L}$ implies $\inf u \leq C \sup u$).
