Let $A = K[x_1, ..., x_n]$ a ring of polynomials over a field $K$ and $I$ a principal (non-zero) ideal of A. Show that $dim(A/I) = n - 1$.
attempt: By the Principal Ideal Theorem it is easy to see that the height $ht (I) = 1$. Furthermore, there is a relationship of the type $dim(A/P) + ht(P) = dim(A)$. But $P$ has to be prime. In the case of exercise $I$ it is not necessarily prime.
We may write $I = (f)$ for $f \in K[x_1, \dots, x_n]$. Now $f$ admits an irreducible decomposition $f = f_1 \cdots f_k$ where each $(f_i)$ is a prime ideal. Your argument in the question shows that the dimension of each $K[x_1, \dots, x_n]/(f_i)$ is $n - 1$.
Let $\mathfrak{p}_0 \subset \mathfrak{p_1} \subset \cdots \subset \mathfrak{p}_m$ be a chain of prime ideals with strict inclusions in $K[x_1, \dots, x_n]/(f)$. By abuse of notation let's view these as prime ideals in $K[x_1, \dots, x_n]$ containing $(f)$. $$(f) \subset \mathfrak{p}_0 \subset \mathfrak{p_1} \subset \cdots \subset \mathfrak{p}_m.$$ Now $f = f_1 \cdots f_k \in \mathfrak{p}_0$, so by the definition of a prime ideal we must have that $f_i \in \mathfrak{p}$ for some $i$ so that $(f_i) \subset \mathfrak{p}_0$. Hence, this chain corresponds to a chain of prime ideals in $K[x_1, \dots, x_n]/(f_i)$ so $m \leq n - 1$. This shows that $\dim(K[x_1, \dots, x_n]/(f)) \leq n - 1$
Conversely, if we have a maximal chain in $K[x_1, \dots, x_n]/(f_i)$ corresponding to $$(f_i) \subseteq \mathfrak{p}_0 \subset \cdots \subset \mathfrak{p}_{n - 1},$$ we know that $(f) \subset (f_i)$ so that $(f) \subset \mathfrak{p}_0 \subset \cdots \subset \mathfrak{p}_{n - 1}$ corresponds to a chain of length $n - 1$ in $K[x_1, \dots, x_n]/(f)$. This then gives us that $\dim(K[x_1, \dots, x_n]/(f)) \geq n - 1$ and we're done.