Skip to main content
rewrote answer
Source Link
YCor
  • 63.9k
  • 5
  • 187
  • 285

[Answer completely rewritten.]

Indeed we have:

Fix$\DeclareMathOperator\so{\mathfrak{so}}$Fix $n\ge 2$$n\ge 4$ and $p,q\ge 0$ with $p+q=n$; write $r=\min(p,q)$. Then the minimal codimension for the centralizer of a nonzero element in $\so(p,q)$ is $2n-6$ if $r\ge 2$ and $2n-4$ if $r\in\{0,1\}$.

(The cases $n=2,3$ being straightforward: in this case $2n-4$ is the minimal codimension.)

To prove the result let's consider separately $r\ge 2$ and $r\le 1$. First we have

For every nondegenerate quadratic form $q$ in dimension $n$$n\ge 4$ over a field $K$ of characteristic zero, the maximal dimensioncodimension of the centralizer of aevery nonzero element of $\mathfrak{so}(q)$ is $n(n-1)/2-(2n-4)$ (i.e. the minimal codimension$\ge 2n-6$, which moreover is achieved if $2n-4$$r\ge 2$. $\DeclareMathOperator\so{\mathfrak{so}}$

[Edit: this is incorrect. The minimal codimension is between $2n-4$ and $2n-6$, so the question is not settled at this point.]

Proof:

(1) The first part is to show First let us check that codimension $2n-4$it is achieved. This is actually easy. Diagonalize if $q$$r\ge 2$. Indeed, and thuswe then choose an orthogonal decomposition ofa basis $(e_1,\dots,e_n)$ for which the ambient space asbilinear form $V=V_2\oplus V'$ with$b$ associated to $V_2$ 2-dimensional. Choose a nonzero element$q$ satisfies $g$ of$b(e_1,e_n)=b(e_2,e_{n-1})=1$, and such that the 1-dimensionalsubspaces of bases $\so(q|_{V_2})$. Extend it as zero on$(e_1,e_2,e_{n-1},e_n)$ and $V'$$(e_3,\dots,e_{n-2})$ are orthogonal. So we can view $g$ as an elementDecomposing matrices with blocks of size $\so(q)(K)$. Then$1+1+(n-4)+1+1$, consider the matrix $$g=\begin{pmatrix}0 & 0 & \quad 0\quad & 1 & 0\\ 0 & 0 & 0 & 0 & -1 \\ \\0 & 0 & 0 & 0 & 0 \\ \\ 0 & 0 & 0 & 0 & 0\\ 0 & 0 & 0 & 0 & 0\end{pmatrix}.$$ Then its centralizer in $\so(q)$ has codimension $2n-4$$2n-6$. Indeed, to compute it, wethe latter verification can extend extend scalars to assume $K$ algebraically closed (this is inessential, just simplifies computations)be performed over an algebraic closure, and hencein which case we can suppose furthermore that the basis is orthonormal$b(e_i,e_j)=\delta_{i+j,n+1}$. ThenSo $\so(q)$ is the spaceconsists of matrices that are skew-symmetric matrices andwith respect to the antidiagonal. In such a basis, the centralizer of $g$ consists of those withmatrices of the form $$\begin{pmatrix}a & b & \quad x\quad & 1 & 0\\ c & -a & y & 0 & -1 \\ \\0 & 0 & h & -y^\mathrm{t} & -x^\mathrm{t} \\ \\ 0 & 0 & 0 & a & -b\\ 0 & 0 & 0 & -c & -a\end{pmatrix}$$ for (linearly independent) conditions$a,b,c,d$ arbitrary scalars, $g_{ij}=0$ for$x,y$ arbitrary $i=1,2$$(n-4)$-vectors, and $j=3,\dots,n$.

(2) Now let us show that codimension$h$ arbitrary square matrix of size $2n-6$$n-4$ that is an lower bound for the dimension ofskew-symmetric with respect to the centralizer of a nonzero elementantidiagonal. This has codimension $g$$2n-6$. For this

In the other direction, we can assume from the beginning that $K$ is algebraically closeddirectly pass to an algebraic closure. Now I borrow the argument from this answer by Peter McNamara: we can suppose that (the projection of) $g$ belongs to closed adjoint orbit in $\mathbf{P}(\so_n)$ (indeed passing from a non-closed orbit to its boundary decreases the orbit dimension and does not decrease the dimension of the centralizer). And (see that same answer), this means that $g$ is, up to conjugation, a nonzero element in a root space. Fixing a Cartan subalgebra, we have 1 or 2 orbits of roots according to whether $n\ge 4$ is even or odd (call them long roots and short roots, assuming that for even $n$ there are only long roots — for $n=3$ there are only short roots). In both cases the computation shows that these root spaces have a centralizer of codimension $2n-4$. (Edit: theThe long roots have a centralizer of codimension $2n-6$ (this is the computation above). Whence this lower bound on the codimension. The(The short roots have a centralizer of codimension $2n-4$, but this is a priori only relevant for $n=3$.)

In order to deal with the case $r\le 1$, here's a result in general.

Fix $n\ge 2$. For every nondegenerate quadratic form $q$ in dimension $n$ over a field $K$ of characteristic zero, the codimension of the centralizer of every nonzero semisimple element of $\mathfrak{so}(q)$ is $\ge 2n-4$, which is achieved.

To show that it is achieved, diagonalize $q$, and thus choose an orthogonal decomposition of the ambient space as $V=V_2\oplus V'$ with $V_2$ 2-dimensional. Choose a nonzero element $g$ of the 1-dimensional $\so(q|_{V_2})$. Extend it as zero on $V'$. So we can view $g$ as an element of $\so(q)(K)$. Then its centralizer has codimension $2n-4$. Indeed, to compute it, we can extend extend scalars to assume $K$ algebraically closed (this is inessential, just simplifies computations), and hence we can suppose that the basis is orthonormal. Then $\so(q)$ is the space of skew-symmetric matrices and the centralizer of $g$ consists of those with the (linearly independent) conditions $g_{ij}=0$ for $i=1,2$, $j=3,\dots,n$.

To show that this is a lower bound, we can suppose that the field is algebraically closed. So, we can deal with the bilinear form $b(e_i,e_j)=\delta_{i+j,n+1}$ as above, so that $\so(q)$ consists of skew-symmetric matrices with respect to the skew-diagonal. A Cartan subalgebra consists of those diagonal matrices therein, and we can restrict to elements in this Cartan subalgebra. Replacing each nonzero diagonal entry $x$ with $x/|x|$ will not decrease the centralizer, so we can suppose that $x$ has only the eigenvalues $\pm 1$ and possibly $0$. Then if $m_0$ and $m_1$ are the multiplicity of the eigenvalues $0$ and $1$, we have $n=m_0+2m_1$ and the centralizer has dimension $d=m_1^2+m_0(m_0-1)/2$. Writing $m=m_0$ this yields $d=(n-m)^2/4+m(m-1)/2$ (where $m<n$ is such that $n-m$ is even). One sees this is maximal for $m=n-2$, namely dimension $1+(n-2)(n-3)/2$, and this means codimension $2n-4$.

To conclude the initial result: if the rank $r$ is zero all elements are semisimple and the result follows.

It remains to consider the case of $\so(1,n-1)$ (this might be true over more general fields in rank 1, but I haven't checked). One direction is already settled: there is a semisimple element whose centralizer has codimension $2n-4$. We have to see that every nonzero element $g$ has a centralizer of codimension $\ge 2n-4$. Passing from an element to its nilpotent and semisimple part in the additive Jordan-Dunford decomposition does not decrease the dimension of centralizer. So we can suppose that $g$ is nilpotent or semisimple. The semisimple case is already settled. So we can suppose $g$ nilpotent. All nonzero nilpotent elements in $\so(1,n-1)$ are indeed conjugate and for each of them, the centralizer indeed has codimension $2n-4$.

(At the group level, this centralizer is essentially a semidirect product $\mathbf{R}^{n-2}\rtimes\mathrm{O}(n-3)$, namely the centralizer of a nontrivial translation of $\mathbf{R}^{n-2}$ in its isometry group.)

Fix $n\ge 2$. For every nondegenerate quadratic form $q$ in dimension $n$ over a field $K$ of characteristic zero, the maximal dimension of the centralizer of a nonzero element of $\mathfrak{so}(q)$ is $n(n-1)/2-(2n-4)$ (i.e. the minimal codimension is $2n-4$. $\DeclareMathOperator\so{\mathfrak{so}}$

[Edit: this is incorrect. The minimal codimension is between $2n-4$ and $2n-6$, so the question is not settled at this point.]

Proof:

(1) The first part is to show that codimension $2n-4$ is achieved. This is actually easy. Diagonalize $q$, and thus choose an orthogonal decomposition of the ambient space as $V=V_2\oplus V'$ with $V_2$ 2-dimensional. Choose a nonzero element $g$ of the 1-dimensional $\so(q|_{V_2})$. Extend it as zero on $V'$. So we can view $g$ as an element of $\so(q)(K)$. Then its centralizer has codimension $2n-4$. Indeed, to compute it, we can extend extend scalars to assume $K$ algebraically closed (this is inessential, just simplifies computations), and hence we can suppose that the basis is orthonormal. Then $\so(q)$ is the space of skew-symmetric matrices and the centralizer of $g$ consists of those with the (linearly independent) conditions $g_{ij}=0$ for $i=1,2$, $j=3,\dots,n$.

(2) Now let us show that codimension $2n-6$ is an lower bound for the dimension of the centralizer of a nonzero element $g$. For this, we can assume from the beginning that $K$ is algebraically closed. Now I borrow the argument from this answer by Peter McNamara: we can suppose that (the projection of) $g$ belongs to closed adjoint orbit in $\mathbf{P}(\so_n)$ (indeed passing from a non-closed orbit to its boundary decreases the orbit dimension and does not decrease the dimension of the centralizer). And (see that same answer), this means that $g$ is, up to conjugation, a nonzero element in a root space. Fixing a Cartan subalgebra, we have 1 or 2 orbits of roots according to whether $n\ge 4$ is even or odd (call them long roots and short roots, assuming that for even $n$ there are only long roots — for $n=3$ there are only short roots). In both cases the computation shows that these root spaces have a centralizer of codimension $2n-4$. (Edit: the long roots have a centralizer of codimension $2n-6$. Whence this lower bound on the codimension. The short roots have a centralizer of codimension $2n-4$, but this is a priori only relevant for $n=3$.)

[Answer completely rewritten.]

Indeed we have:

$\DeclareMathOperator\so{\mathfrak{so}}$Fix $n\ge 4$ and $p,q\ge 0$ with $p+q=n$; write $r=\min(p,q)$. Then the minimal codimension for the centralizer of a nonzero element in $\so(p,q)$ is $2n-6$ if $r\ge 2$ and $2n-4$ if $r\in\{0,1\}$.

(The cases $n=2,3$ being straightforward: in this case $2n-4$ is the minimal codimension.)

To prove the result let's consider separately $r\ge 2$ and $r\le 1$. First we have

For every nondegenerate quadratic form $q$ in dimension $n\ge 4$ over a field $K$ of characteristic zero, the codimension of the centralizer of every nonzero element of $\mathfrak{so}(q)$ is $\ge 2n-6$, which moreover is achieved if $r\ge 2$.

First let us check that it is achieved if $r\ge 2$. Indeed, we then choose a basis $(e_1,\dots,e_n)$ for which the bilinear form $b$ associated to $q$ satisfies $b(e_1,e_n)=b(e_2,e_{n-1})=1$, and such that the subspaces of bases $(e_1,e_2,e_{n-1},e_n)$ and $(e_3,\dots,e_{n-2})$ are orthogonal. Decomposing matrices with blocks of size $1+1+(n-4)+1+1$, consider the matrix $$g=\begin{pmatrix}0 & 0 & \quad 0\quad & 1 & 0\\ 0 & 0 & 0 & 0 & -1 \\ \\0 & 0 & 0 & 0 & 0 \\ \\ 0 & 0 & 0 & 0 & 0\\ 0 & 0 & 0 & 0 & 0\end{pmatrix}.$$ Then its centralizer in $\so(q)$ has codimension $2n-6$. Indeed, the latter verification can be performed over an algebraic closure, in which case we can suppose furthermore that $b(e_i,e_j)=\delta_{i+j,n+1}$. So $\so(q)$ consists of matrices that are skew-symmetric with respect to the antidiagonal. In such a basis, the centralizer of $g$ consists of those matrices of the form $$\begin{pmatrix}a & b & \quad x\quad & 1 & 0\\ c & -a & y & 0 & -1 \\ \\0 & 0 & h & -y^\mathrm{t} & -x^\mathrm{t} \\ \\ 0 & 0 & 0 & a & -b\\ 0 & 0 & 0 & -c & -a\end{pmatrix}$$ for $a,b,c,d$ arbitrary scalars, $x,y$ arbitrary $(n-4)$-vectors, and $h$ arbitrary square matrix of size $n-4$ that is skew-symmetric with respect to the antidiagonal. This has codimension $2n-6$.

In the other direction, we can directly pass to an algebraic closure. Now I borrow the argument from this answer by Peter McNamara: we can suppose that (the projection of) $g$ belongs to closed adjoint orbit in $\mathbf{P}(\so_n)$ (indeed passing from a non-closed orbit to its boundary decreases the orbit dimension and does not decrease the dimension of the centralizer). And (see that same answer), this means that $g$ is, up to conjugation, a nonzero element in a root space. Fixing a Cartan subalgebra, we have 1 or 2 orbits of roots according to whether $n\ge 4$ is even or odd (call them long roots and short roots, assuming that for even $n$ there are only long roots — for $n=3$ there are only short roots). The long roots have a centralizer of codimension $2n-6$ (this is the computation above). Whence this lower bound on the codimension. (The short roots have a centralizer of codimension $2n-4$, but this is a priori only relevant for $n=3$.)

In order to deal with the case $r\le 1$, here's a result in general.

Fix $n\ge 2$. For every nondegenerate quadratic form $q$ in dimension $n$ over a field $K$ of characteristic zero, the codimension of the centralizer of every nonzero semisimple element of $\mathfrak{so}(q)$ is $\ge 2n-4$, which is achieved.

To show that it is achieved, diagonalize $q$, and thus choose an orthogonal decomposition of the ambient space as $V=V_2\oplus V'$ with $V_2$ 2-dimensional. Choose a nonzero element $g$ of the 1-dimensional $\so(q|_{V_2})$. Extend it as zero on $V'$. So we can view $g$ as an element of $\so(q)(K)$. Then its centralizer has codimension $2n-4$. Indeed, to compute it, we can extend extend scalars to assume $K$ algebraically closed (this is inessential, just simplifies computations), and hence we can suppose that the basis is orthonormal. Then $\so(q)$ is the space of skew-symmetric matrices and the centralizer of $g$ consists of those with the (linearly independent) conditions $g_{ij}=0$ for $i=1,2$, $j=3,\dots,n$.

To show that this is a lower bound, we can suppose that the field is algebraically closed. So, we can deal with the bilinear form $b(e_i,e_j)=\delta_{i+j,n+1}$ as above, so that $\so(q)$ consists of skew-symmetric matrices with respect to the skew-diagonal. A Cartan subalgebra consists of those diagonal matrices therein, and we can restrict to elements in this Cartan subalgebra. Replacing each nonzero diagonal entry $x$ with $x/|x|$ will not decrease the centralizer, so we can suppose that $x$ has only the eigenvalues $\pm 1$ and possibly $0$. Then if $m_0$ and $m_1$ are the multiplicity of the eigenvalues $0$ and $1$, we have $n=m_0+2m_1$ and the centralizer has dimension $d=m_1^2+m_0(m_0-1)/2$. Writing $m=m_0$ this yields $d=(n-m)^2/4+m(m-1)/2$ (where $m<n$ is such that $n-m$ is even). One sees this is maximal for $m=n-2$, namely dimension $1+(n-2)(n-3)/2$, and this means codimension $2n-4$.

To conclude the initial result: if the rank $r$ is zero all elements are semisimple and the result follows.

It remains to consider the case of $\so(1,n-1)$ (this might be true over more general fields in rank 1, but I haven't checked). One direction is already settled: there is a semisimple element whose centralizer has codimension $2n-4$. We have to see that every nonzero element $g$ has a centralizer of codimension $\ge 2n-4$. Passing from an element to its nilpotent and semisimple part in the additive Jordan-Dunford decomposition does not decrease the dimension of centralizer. So we can suppose that $g$ is nilpotent or semisimple. The semisimple case is already settled. So we can suppose $g$ nilpotent. All nonzero nilpotent elements in $\so(1,n-1)$ are indeed conjugate and for each of them, the centralizer indeed has codimension $2n-4$.

(At the group level, this centralizer is essentially a semidirect product $\mathbf{R}^{n-2}\rtimes\mathrm{O}(n-3)$, namely the centralizer of a nontrivial translation of $\mathbf{R}^{n-2}$ in its isometry group.)

mentioned error
Source Link
YCor
  • 63.9k
  • 5
  • 187
  • 285

Fix $n\ge 2$. For every nondegenerate quadratic form $q$ in dimension $n$ over a field $K$ of characteristic zero, the maximal dimension of the centralizer of a nonzero element of $\mathfrak{so}(q)$ is $n(n-1)/2-(2n-4)$ (i.e. the minimal codimension is $2n-4$. $\DeclareMathOperator\so{\mathfrak{so}}$

[Edit: this is incorrect. The minimal codimension is between $2n-4$ and $2n-6$, so the question is not settled at this point.]

Proof:

(1) The first part is to show that thiscodimension $2n-4$ is achieved. This is actually easy. Diagonalize $q$, and thus choose an orthogonal decomposition of the ambient space as $V=V_2\oplus V'$ with $V_2$ 2-dimensional. Choose a nonzero element $g$ of the 1-dimensional $\so(q|_{V_2})$. Extend it as zero on $V'$. So we can view $g$ as an element of $\so(q)(K)$. Then its centralizer has codimension $2n-4$. Indeed, to compute it, we can extend extend scalars to assume $K$ algebraically closed (this is inessential, just simplifies computations), and hence we can suppose that the basis is orthonormal. Then $\so(q)$ is the space of skew-symmetric matrices and the centralizer of $g$ consists of those with the (linearly independent) conditions $g_{ij}=0$ for $i=1,2$, $j=3,\dots,n$.

(2) Now we need tolet us show that thiscodimension $2n-6$ is an upperlower bound for the dimension of the centralizer of a nonzero element $g$. For this, we can assume from the beginning that $K$ is algebraically closed. Now I borrow the argument from this answer by Peter McNamara: we can suppose that (the projection of) $g$ belongs to closed adjoint orbit in $\mathbf{P}(\so_n)$ (indeed passing from a non-closed orbit to its boundary decreases the orbit dimension and does not decrease the dimension of the centralizer). And (see that same answer), this means that $g$ is, up to conjugation, a nonzero element in a root space. Fixing a Cartan subalgebra, we have 1 or 2 orbits of roots according to whether $n$$n\ge 4$ is even or odd (call them long roots and short roots, but in both cases the computation showsassuming that these root spacesfor even $n$ there are only long roots — for $n=3$ there are only short roots). In both cases the computation shows that these root spaces have a centralizer of codimension $2n-4$. (Edit: the long roots have a centralizer of codimension $2n-6$. Whence this lower bound on the codimension. The short roots have a centralizer of codimension $2n-4$, but this is a priori only relevant for $n=3$.)

Fix $n\ge 2$. For every nondegenerate quadratic form $q$ in dimension $n$ over a field $K$ of characteristic zero, the maximal dimension of the centralizer of a nonzero element of $\mathfrak{so}(q)$ is $n(n-1)/2-(2n-4)$ (i.e. the minimal codimension is $2n-4$. $\DeclareMathOperator\so{\mathfrak{so}}$

Proof:

(1) The first part is to show that this is achieved. This is actually easy. Diagonalize $q$, and thus choose an orthogonal decomposition of the ambient space as $V=V_2\oplus V'$ with $V_2$ 2-dimensional. Choose a nonzero element $g$ of the 1-dimensional $\so(q|_{V_2})$. Extend it as zero on $V'$. So we can view $g$ as an element of $\so(q)(K)$. Then its centralizer has codimension $2n-4$. Indeed, to compute it, we can extend extend scalars to assume $K$ algebraically closed (this is inessential, just simplifies computations), and hence we can suppose that the basis is orthonormal. Then $\so(q)$ is the space of skew-symmetric matrices and the centralizer of $g$ consists of those with the (linearly independent) conditions $g_{ij}=0$ for $i=1,2$, $j=3,\dots,n$.

(2) Now we need to show that this is an upper bound for the centralizer of a nonzero element $g$. For this, we can assume from the beginning that $K$ is algebraically closed. Now I borrow the argument from this answer by Peter McNamara: we can suppose that (the projection of) $g$ belongs to closed adjoint orbit in $\mathbf{P}(\so_n)$ (indeed passing from a non-closed orbit to its boundary decreases the orbit dimension and does not decrease the dimension of the centralizer). And (see that same answer), this means that $g$ is, up to conjugation, a nonzero element in a root space. Fixing a Cartan subalgebra, we have 1 or 2 orbits of roots according to whether $n$ is even or odd, but in both cases the computation shows that these root spaces have a centralizer of codimension $2n-4$.

Fix $n\ge 2$. For every nondegenerate quadratic form $q$ in dimension $n$ over a field $K$ of characteristic zero, the maximal dimension of the centralizer of a nonzero element of $\mathfrak{so}(q)$ is $n(n-1)/2-(2n-4)$ (i.e. the minimal codimension is $2n-4$. $\DeclareMathOperator\so{\mathfrak{so}}$

[Edit: this is incorrect. The minimal codimension is between $2n-4$ and $2n-6$, so the question is not settled at this point.]

Proof:

(1) The first part is to show that codimension $2n-4$ is achieved. This is actually easy. Diagonalize $q$, and thus choose an orthogonal decomposition of the ambient space as $V=V_2\oplus V'$ with $V_2$ 2-dimensional. Choose a nonzero element $g$ of the 1-dimensional $\so(q|_{V_2})$. Extend it as zero on $V'$. So we can view $g$ as an element of $\so(q)(K)$. Then its centralizer has codimension $2n-4$. Indeed, to compute it, we can extend extend scalars to assume $K$ algebraically closed (this is inessential, just simplifies computations), and hence we can suppose that the basis is orthonormal. Then $\so(q)$ is the space of skew-symmetric matrices and the centralizer of $g$ consists of those with the (linearly independent) conditions $g_{ij}=0$ for $i=1,2$, $j=3,\dots,n$.

(2) Now let us show that codimension $2n-6$ is an lower bound for the dimension of the centralizer of a nonzero element $g$. For this, we can assume from the beginning that $K$ is algebraically closed. Now I borrow the argument from this answer by Peter McNamara: we can suppose that (the projection of) $g$ belongs to closed adjoint orbit in $\mathbf{P}(\so_n)$ (indeed passing from a non-closed orbit to its boundary decreases the orbit dimension and does not decrease the dimension of the centralizer). And (see that same answer), this means that $g$ is, up to conjugation, a nonzero element in a root space. Fixing a Cartan subalgebra, we have 1 or 2 orbits of roots according to whether $n\ge 4$ is even or odd (call them long roots and short roots, assuming that for even $n$ there are only long roots — for $n=3$ there are only short roots). In both cases the computation shows that these root spaces have a centralizer of codimension $2n-4$. (Edit: the long roots have a centralizer of codimension $2n-6$. Whence this lower bound on the codimension. The short roots have a centralizer of codimension $2n-4$, but this is a priori only relevant for $n=3$.)

Source Link
YCor
  • 63.9k
  • 5
  • 187
  • 285

Fix $n\ge 2$. For every nondegenerate quadratic form $q$ in dimension $n$ over a field $K$ of characteristic zero, the maximal dimension of the centralizer of a nonzero element of $\mathfrak{so}(q)$ is $n(n-1)/2-(2n-4)$ (i.e. the minimal codimension is $2n-4$. $\DeclareMathOperator\so{\mathfrak{so}}$

Proof:

(1) The first part is to show that this is achieved. This is actually easy. Diagonalize $q$, and thus choose an orthogonal decomposition of the ambient space as $V=V_2\oplus V'$ with $V_2$ 2-dimensional. Choose a nonzero element $g$ of the 1-dimensional $\so(q|_{V_2})$. Extend it as zero on $V'$. So we can view $g$ as an element of $\so(q)(K)$. Then its centralizer has codimension $2n-4$. Indeed, to compute it, we can extend extend scalars to assume $K$ algebraically closed (this is inessential, just simplifies computations), and hence we can suppose that the basis is orthonormal. Then $\so(q)$ is the space of skew-symmetric matrices and the centralizer of $g$ consists of those with the (linearly independent) conditions $g_{ij}=0$ for $i=1,2$, $j=3,\dots,n$.

(2) Now we need to show that this is an upper bound for the centralizer of a nonzero element $g$. For this, we can assume from the beginning that $K$ is algebraically closed. Now I borrow the argument from this answer by Peter McNamara: we can suppose that (the projection of) $g$ belongs to closed adjoint orbit in $\mathbf{P}(\so_n)$ (indeed passing from a non-closed orbit to its boundary decreases the orbit dimension and does not decrease the dimension of the centralizer). And (see that same answer), this means that $g$ is, up to conjugation, a nonzero element in a root space. Fixing a Cartan subalgebra, we have 1 or 2 orbits of roots according to whether $n$ is even or odd, but in both cases the computation shows that these root spaces have a centralizer of codimension $2n-4$.