I am having problems with establishing the following basic result. Actually, I found a previous post that is close in nature (it is about inverse image), but I was interested in this specific one, with the following notation, because it is the one I found in the book I am self-studying and I guess that most of my problems are actually related with the notation itself. Morevoer I would like to take it as an opportunity to find out how to write proof with equalities, because I tend in those cases to write them in a cumbersome way, with necessary and sufficient conditions.
[I assume that this is partly due to the influence of "How to prove it: a structured approach", a book that I loved, but that left me the tendency to be quite mechanical in proving any sort of result].
Theorem:
Let $X$ and $Y$ be nonempty sets and $f \in Y^X$. Prove that, for any (nonempty) classes $\mathcal{A} \subseteq 2^X$, we have
$ f(\cup \mathcal{A}) = \cup \{f(A):A \in \mathcal{A} \} $
Here, it's how I approach the problem.
Tentative Proof:
First of all, by definition of (direct) image of a function, we have
$$f(\cup \mathcal{A}) := \{f(x):x\in \cup \mathcal{A} \}. \hspace{1cm} (*)$$
Let $X$, $Y$ be arbitrary (nonempty) sets. Let $f$ be an arbitrary function that maps from $X$ to $Y$ and let $\mathcal{A}$ be a family of sets, subset of the powerset of $X$. By $(*)$, the result we have to prove becomes
$$ \{f(x):x \in \cup \mathcal{A} \} = \cup \{ f(A):A \in \mathcal{A}\} \hspace{1cm} (1)$$
In order to prove it, rephrase $(1)$ as
$$ \forall y ( y \in \{f(x):x \in \cup \mathcal{A} \} \leftrightarrow y \in \cup \{ f(A):A \in \mathcal{A}\}). \hspace{1cm} (2)$$
We start by proving the necessary condition. Let $y$ be an arbitrary element and assume that $y$ is a member of $\{f(x):x \in \cup \mathcal{A} \}$. This means that $\exists x(x \in \cup \mathcal{A} \land y=x)$. At the same time, we have to prove that $\exists A(A \in \mathcal{A} \land y\in f(A))$.
And here I got stuck...
I really don't see how from my premises I can get the desired result. Indeed, what $A$ should be?
I assume there is a problem with the way in which I translate the problem in logical terms.