Exists $f \in k\{X\}$ such that $I = \{g \cdot f \mid g \in k\{X\}\}$? Let $k$ be a field, $X$ a finite set, $k\{X\}$ the algebra of $k$-valued functions on $X$, and $I \subset k\{X\}$ an ideal (in the sense of ring theory). Is it true that there exists $f \in k\{X\}$ such that $I = \{g \cdot f \mid g \in k\{X\}\}$?
 A: You are asking if $k\{X\}$ is necessarily a principal ideal ring. This is the case when $X$ is finite, because principal ideal rings are closed under finite direct products.  
We need only verify that $k\{X\}$ is isomorphic as a $k$-algebra to $k^{|X|}$.  Let $\phi(f) = (f(x_1),f(x_2),\ldots,f(x_n))$ where $X =\{x_1,\ldots,x_n\}$.  Then the addition and multiplication operations are preserved (along with $k$-scalar multiplication), and the kernel of $\phi$ is trivial.
In this special case (special in that the field $k$ is trivially a principal ideal ring), we can explicitly identify a function $f:X\to k$ that generates a specified ideal $I$.  Let $Z\subseteq X$ be the points $z\in X$ for which $g(z)=0$ for all $g\in I$.  Define $f$ such that:
$$ f(x) = \begin{cases} 0 & \text{if } x\in Z \\ 1 & \text{otherwise} \end{cases} $$
Clearly for any $g\in I$, $g(x) = g(x)\cdot f(x)$ for any $x\in X$.  So $I \subseteq f\cdot k\{X\}$.  To show the other direction of inclusion amounts to showing $f\in I$.
Since $X$ is finite, one way to prove $f\in X$ is to express it as a finite sum of functions in $I$.  In particular consider those $w \in X \setminus Z$, namely the points in $X$ for which some $g_w\in I$ is nonzero at $x=w$.  Construct:
$$ f_w(x) = \begin{cases} 1 & \text{if } x = w \\ 0 & \text{otherwise} \end{cases} $$
$$ f_w(x) = (g_w(w))^{-1} f_w(x) g_w(x) $$
Thus $f$ is the sum of the distinct $f_w \in I$, hence $f\in I$.
