$O(n)$ is an extension of $\mathbb{Z}\_2$ by $SO(n)$, 
$$1\to SO(n) \to O(n)\to \mathbb{Z}\_2 \to 1.$$


Below we denote the Stiefel-Whitney class of real vector bundle $V\_G$ of the group $G$ as:
$$
w\_j(V\_{G}) : =w\_j({G}).
$$



> 
> My question is that how do the "generalized" Stiefel-Whitney class of $O(n)$ and $SO(n)$ relate to each other? What are related conversion formulas for
>  $$
> w\_j(O(n)) = w\_j(SO(n)) + ...?
> $$
> 
> 
> 


What I have known are that:


1. $$
w\_3({O(3)})=w\_1({O(3)})^3+w\_1({O(3)})w\_2({SO(3)})+w\_3({SO(3)})
$$
$$
{=w\_1(\mathbb{Z}\_2)^3+w\_1(\mathbb{Z}\_2)w\_2(SO(3))+w\_3(SO(3)) }
$$
$$
=w\_1(\mathbb{Z}\_2)^3+w\_1(\mathbb{Z}\_2)w\_2(SO(3))+w\_3(SO(3)) 
$$
$$
{=w\_1(\mathbb{Z}\_2)^3+w\_1(\mathbb{Z}\_2)w\_2(SO(3))+w\_1(TM)w\_2(O(3))}
$$
$$
{=w\_1(\mathbb{Z}\_2)^3+w\_1(\mathbb{Z}\_2)w\_2(SO(3))+w\_1(TM)w\_2(SO(3))}
$$


2.
$$
w\_2({O(3)})=w\_1({O(3)})^2+w\_1({O(3)})w\_2({SO(3)})
$$
$$
=w\_1(\mathbb{Z}\_2)^2+w\_1(\mathbb{Z}\_2)w\_2({SO(3)})
$$


3. When $n=1 \mod 4$,
$$w\_2(O(n)) = w\_2(SO(n)) \mod 2, 
$$
When $n=3 \mod 4$,


$$
 w\_2(O(n)) = w\_2(SO(n)) + w\_1 \cup w\_1 \mod 2,
$$


The $w\_1 \cup w\_1$ is an obstruction to lifting $w\_1$ to $\mathbb Z\_4$ cohomology class.


Again, do we have 



> 
> $$
> w\_j(O(n)) = w\_j(SO(n)) + ...?
> $$
> 
> 
> 


also, do we have



> 
> $$
> w\_2(O(2)) = w\_2(SO(2))?
> $$
> $$
> w\_j(O(2)) = w\_j(SO(2))?
> $$
> 
> 
> 


Edit for clarification:
p.s. See eq. 2.5 of [this journal free-access online article](https://scipost.org/SciPostPhys.4.4.021/pdf) -- I am using the same definition as theirs of “generalized” Stiefel-Whitney class of real vector bundles: $w\_j(O(n))$ and $w\_j(SO(n))$.



Conversion formula between "generalized" Stiefel-Whitney class of real vector bundles: O(n) and SO(n)
First I will write up what your question is asking in terms of Arun Debray's comment. I strongly suggest that when discussing questions like this, you use precise notation as in the following; I found your question impossible to understand until that comment. 


First, the Stiefel-Whitney classes are a set of generators of the cohomology ring of $BO(n)$: we have the presentation $H^\*(BO(n);\Bbb F\_2) = \Bbb F\_2[w\_1, \cdots, w\_n]$. Via the inclusion map $i: SO(n) \to O(n)$, we have a map $BSO(n) \to BO(n)$, and the induced map $i^\*: H^\*(BO(n);\Bbb F\_2) \to H^\*(BSO(n);\Bbb F\_2)$ is well-known to have kernel $\langle w\_1\rangle$; in particular, we may use this homomorphism to write $H^\*(BSO(n);\Bbb F\_2) = \Bbb F\_2[w\_2, \cdots, w\_n]$, where these classes are the images of the correspinding $w\_i$ under restriction. In particular, one computes the Stiefel-Whitney classes of an oriented bundle by forgetting the orientation.


You have a group homomorphism $p: O(n) \to SO(n)$ given by $p(A) = \det A \cdot A$; this induces a map of classifying spaces $BO(n) \to BO(n)$, with image inside $BSO(n)$ when $N$ is odd. 



> 
> Your question is: in terms of the generators specified above, what is the induced map $f^\*: H^\*(BO(n);\Bbb F\_2) \to H^\*(BO(n);\Bbb F\_2)$? 
> 
> 
> 


The way to do this is to investigate what this does at the level of vector bundles; it takes an unoriented vector bundle $E$ to the corresponding canonically oriented bundle $E \otimes \det(E)$; that is, $$(f^\*w\_i)(E) = w\_i(E \otimes \det(E)).$$


I claim that if $E$ has rank $k$, then $$w\_i\left(E \otimes \det(E)\right) = \sum\_{j=0}^i \binom{k-j}{k-i} w\_1(E)^{i-j} w\_j(E),$$ and in fact a more general formula is true for any even-rank bundle $V$ replacing $E$ and any real line bundle replacing $\det(E)$.


This follows from the splitting principle: if $V$ splits as a direct sum $V = \eta\_1 \oplus \cdots \oplus \eta\_{k}$, then $$V \otimes \lambda = \bigoplus (\eta\_i \otimes \lambda),$$ and taking Stiefel-Whitney classes before and after taking the tensor product, we have $$w(V) = \prod (1 + w\_1(\eta\_i)) = \sum\_{i=0}^{k}\sigma\_i(w\_1(\eta\_1), \cdots, w\_1(\eta\_{k}))$$ and $$w(V \otimes \lambda) = \prod (1 + w\_1(\eta\_i) + w\_1(\lambda)) = \sum\_{i=0}^k \sigma\_i(w\_1(\eta\_i) + w\_1(\lambda), \cdots, w\_1(\eta\_k) + w\_1(\lambda))),$$ where $\sigma\_i$ is the $i$th symmetric polynomial in $k$ variables. Expanding the latter out, we obtain $$\sum\_{i=0}^k \sum\_{j=0}^i \binom{k-j}{k-i} w\_1(\lambda)^{i-j} \sigma\_j(w\_1(\eta\_1), \cdots, w\_1(\eta\_k)) = \sum\_{i=0}^k \sum\_{j=0}^i \binom{k-j}{k-i} w\_1(\lambda)^{i-j}w\_j(V);$$ the binomial appears because when counting terms of this form, we first fix the $j$-element of $w\_1(\eta)$'s that arise, and then choose from the remaining $(k-j)$-element set a collection of $(i-j)$ copies of $w\_1(\lambda)$.


The splitting principle says that any formula of characteristic classes which is true for direct sums of line bundles is true for all bundles, so the general result follows. This is your desired formula.


Plugging in, we find that your desired formulas in (3) are correct: we have $f^\*w\_2 = w\_2 + (k-1) w\_1^2 + \binom{k-1}{k-3} w\_1^2 = w\_2 + \frac{(k-1)(k+2)}{2} w\_1^2$, and this is equal to $w\_2$ for $k \equiv 1, 2 \pmod 4$ and equal to $w\_2 + w\_1^2$ for $k \equiv 0, 3 \pmod 4$, as desired.


Note for your last displayed formula that $E \otimes \det(E)$ is *not* oriented when $E$ has even rank. However, it is true that in rank 2, $E \otimes \det(E) \cong E$, which gives $f^\*w\_j = w\_j$ in this case. 


