What's the word for being able to "pull something out of a function"? If I have something like $(5x + 7x) = x(5 + 7),$ I've "factored" out the $x$.
With linear functions you can say $f(a \cdot x) = a \cdot f(x)$ "by linearity", you've (for lack of better phrasing) "pulled out the multiplication".
Or for preimages of sets, the preimage of union = union of preimage $f^{-1}(\cup_i A_i) = \cup_i f^{-1}(A_i)$.
Is there a general term for saying some operation inside a function works in a similar way? Something like
$$f(A \odot B) = f(A) \odot f(B)$$
where $\odot$ is some general operator. I guess we could say "linearity in $\odot$", is that standard?
 A: "Linearity" is a notion for vector spaces.
The term you are looking for is called "homomorphism".
A homomorphism is a map between two algebraic structures of the same type (that is of the same name), that preserves the operations of the structures.
One says often that the homomorphism $f$ preserves the operation $\odot$ or is compatible with the operation.
A: I see this as a special case of what category theory calls commuting.
In your first example, you start with the two numbers $5$ and $7$. If you first multiply them both by $x$, then add them together, you get the same result as you do if you first add them, then multiply the result with $x$. This isn't difficult to describe with a square-shaped commutative diagram. The same goes for your $\odot$ example.
If you have a linear map, applying that map commutes with multiplication by a constant in this category theoretical sense. This aligns with the matrix fact that the identity matrix and multiples thereof commute with other (square) matrices.
For your preimage example, anyone familiar with category theory would know exactly what you mean if you say that unions commute with taking preimages of a function.
A: This is also called distributivity.  Your first example,
$$  5x+7x = x(5+7)  $$
is a statement of distributivity of multiplication over addition (and assumes commutative multiplication, otherwise the right-hand side would be "$(5+7)x$").
In your terminal example, you could state "$f$ distributes over $\odot$".
A: In the context of abstract algebra, where the domain and range of $f$ may not always be the same set, the term "homomorphism" can often be seen.
