In algebraic geometry, given a smooth algebraic group G, a G-torsor or a principal G-bundle P over a scheme X is a scheme (or even algebraic space) with the action of G that is locally trivial in the given Grothendieck topology in the sense that the base change 
  
    
      
        Y
        
          ×
          
            X
          
        
        P
      
    
    
   along "some" covering map 
  
    
      
        Y
        →
        X
      
    
    
   is the trivial torsor 
  
    
      
        Y
        ×
        G
        →
        Y
      
    
    
   (G acts only on the second factor). Equivalently, a G-torsor P on X is a principal homogeneous space for the group scheme 
  
    
      
        
          G
          
            X
          
        
        =
        X
        ×
        G
      
    
    
   (i.e., 
  
    
      
        
          G
          
            X
          
        
      
    
    
   acts simply transitively on 
  
    
      
        P
      
    
    
  .)
The definition may be formulated in the sheaf-theoretic language: a sheaf P on the category of X-schemes with some Grothendieck topology is a G-torsor if there is a covering 
  
    
      
        {
        
          U
          
            i
          
        
        →
        X
        }
      
    
    
   in the topology, called the local trivialization, such that the restriction of P to each 
  
    
      
        
          U
          
            i
          
        
      
    
    
   is a trivial 
  
    
      
        
          G
          
            
              U
              
                i
              
            
          
        
      
    
    
  -torsor.
A line bundle is nothing but a 
  
    
      
        
          
            G
          
          
            m
          
        
      
    
    
  -bundle, and, like a line bundle, the two points of views of torsors, geometric and sheaf-theoretic, are used interchangeably (by permitting P to be a stack like an algebraic space if necessary).
Examples and basic properties
Examples
A 
  
    
      
        G
        
          L
          
            n
          
        
      
    
    
  -torsor on "X" is a principal 
  
    
      
        G
        
          L
          
            n
          
        
      
    
    
  -bundle on "X".
If 
  
    
      
        L
        
          /
        
        K
      
    
    
   is a finite Galois extension, then 
  
    
      
        Spec
        
        L
        →
        Spec
        
        K
      
    
    
   is a 
  
    
      
        Gal
        
        (
        L
        
          /
        
        K
        )
      
    
    
  -torsor (roughly because the Galois group acts simply transitively on the roots.) This fact is a basis for Galois descent. See integral extension for a generalization.
Remark: A G-torsor P over X is isomorphic to a trivial torsor if and only if 
  
    
      
        P
        (
        X
        )
        =
        Mor
        
        (
        X
        ,
        P
        )
      
    
    
   is nonempty. (Proof: if there is an 
  
    
      
        s
        :
        X
        →
        P
      
    
    
  , then 
  
    
      
        X
        ×
        G
        →
        P
        ,
        (
        x
        ,
        g
        )
        ↦
        s
        (
        x
        )
        g
      
    
    
   is an isomorphism.)
Let P be a G-torsor with a local trivialization 
  
    
      
        {
        
          U
          
            i
          
        
        →
        X
        }
      
    
    
   in étale topology. A trivial torsor admits a section: thus, there are elements 
  
    
      
        
          s
          
            i
          
        
        ∈
        P
        (
        
          U
          
            i
          
        
        )
      
    
    
  . Fixing such sections 
  
    
      
        
          s
          
            i
          
        
      
    
    
  , we can write uniquely 
  
    
      
        
          s
          
            i
          
        
        
          g
          
            i
            j
          
        
        =
        
          s
          
            j
          
        
      
    
    
   on 
  
    
      
        
          U
          
            i
            j
          
        
      
    
    
   with 
  
    
      
        
          g
          
            i
            j
          
        
        ∈
        G
        (
        
          U
          
            i
            j
          
        
        )
      
    
    
  . Different choices of 
  
    
      
        
          s
          
            i
          
        
      
    
    
   amount to 1-coboundaries in cohomology; that is, the 
  
    
      
        
          g
          
            i
            j
          
        
      
    
    
   define a cohomology class in the sheaf cohomology (more precisely Čech cohomology with sheaf coefficient) group 
  
    
      
        
          H
          
            1
          
        
        (
        X
        ,
        G
        )
      
    
    
  . A trivial torsor corresponds to the identity element. Conversely, it is easy to see any class in 
  
    
      
        
          H
          
            1
          
        
        (
        X
        ,
        G
        )
      
    
    
   defines a G-torsor on X, unique up to an isomorphism.
If G is a connected algebraic group over a finite field 
  
    
      
        
          
            F
          
          
            q
          
        
      
    
    
  , then any G-bundle over 
  
    
      
        Spec
        
        
          
            F
          
          
            q
          
        
      
    
    
   is trivial. (Lang's theorem.)
Most of constructions and terminology regarding principal bundles in algebraic topology carry over in verbatim to G-bundles. For example, if 
  
    
      
        P
        →
        X
      
    
    
   is a G-bundle and G acts from the left on a scheme F, then one can form the associated bundle 
  
    
      
        P
        
          ×
          
            G
          
        
        F
        →
        X
      
    
    
   with fiber F. In particular, if H is a closed subgroup of G, then for any H-bundle P, 
  
    
      
        P
        
          ×
          
            H
          
        
        G
      
    
    
   is a G-bundle called the induced bundle.
If P is a G-bundle that is isomorphic to the induced bundle 
  
    
      
        
          P
          ′
        
        
          ×
          
            H
          
        
        G
      
    
    
   for some H-bundle P', then P is said to admit a reduction of structure group from G to H.
Let X be a smooth projective curve over an algebraically closed field k, G a semisimple algebraic group and P a G-bundle on a relative curve 
  
    
      
        
          X
          
            R
          
        
        =
        X
        
          ×
          
            Spec
            
            k
          
        
        Spec
        
        R
      
    
    
  , R a finitely generated k-algebra. Then a theorem of Drinfeld and Simpson states that, if G is simply connected and split, there is an étale morphism 
  
    
      
        R
        →
        
          R
          ′
        
      
    
    
   such that 
  
    
      
        P
        
          ×
          
            
              X
              
                R
              
            
          
        
        
          X
          
            
              R
              ′
            
          
        
      
    
    
   admits a reduction of structure group to a Borel subgroup of G.
If P is a parabolic subgroup of a smooth affine group scheme G with connected fibers, then its degree of instability, denoted by 
  
    
      
        
          deg
          
            i
          
        
        
        (
        P
        )
      
    
    
  , is the degree of its Lie algebra 
  
    
      
        Lie
        
        (
        P
        )
      
    
    
   as a vector bundle on X. The degree of instability of G is then 
  
    
      
        
          deg
          
            i
          
        
        
        (
        G
        )
        =
        max
        {
        
          deg
          
            i
          
        
        
        (
        P
        )
        
          |
        
        P
        ⊂
        G
        
           parabolic subgroups
        
        }
      
    
    
  . If G is an algebraic group and E is a G-torsor, then the degree of instability of E is the degree of the inner form 
  
    
      
        
          
          
          
            E
          
        
        G
        =
        
          Aut
          
            G
          
        
        
        (
        E
        )
      
    
    
   of G induced by E (which is a group scheme over X); i.e., 
  
    
      
        
          deg
          
            i
          
        
        
        (
        E
        )
        =
        
          deg
          
            i
          
        
        
        (
        
          
          
          
            E
          
        
        G
        )
      
    
    
  . E is said to be semi-stable if 
  
    
      
        
          deg
          
            i
          
        
        
        (
        E
        )
        ≤
        0
      
    
    
   and is stable if 
  
    
      
        
          deg
          
            i
          
        
        
        (
        E
        )
        <
        0
      
    
    
  .