In mathematics, a relative scalar (of weight w) is a scalar-valued function whose transform under a coordinate transform,
                                                                        x                ¯                                                          j                          =                                                            x                ¯                                                          j                          (                  x                      i                          )                on an n-dimensional manifold obeys the following equation
                                                        f              ¯                                      (                                                            x                ¯                                                          j                          )        =                  J                      w                          f        (                  x                      i                          )                where
                    J        =                              |                                                                                                                                                        ∂                          (                                                      x                                                          1                                                                                ,                          …                          ,                                                      x                                                          n                                                                                )                                                                          ∂                          (                                                                                                                                                      x                                  ¯                                                                                                                                                    1                                                                                ,                          …                          ,                                                                                                                                                      x                                  ¯                                                                                                                                                    n                                                                                )                                                                                                                                          |                          ,                that is, the determinant of the Jacobian of the transformation.  A scalar density refers to the                     w        =        1                 case.
Relative scalars are an important special case of the more general concept of a relative tensor.
An ordinary scalar or absolute scalar refers to the                     w        =        0                 case.
If                               x                      i                                   and                                                                         x                ¯                                                          j                                   refer to the same point                     P                 on the manifold, then we desire                                                         f              ¯                                      (                                                            x                ¯                                                          j                          )        =        f        (                  x                      i                          )                . This equation can be interpreted two ways when                                                                         x                ¯                                                          j                                   are viewed as the "new coordinates" and                               x                      i                                   are viewed as the "original coordinates". The first is as                                                         f              ¯                                      (                                                            x                ¯                                                          j                          )        =        f        (                  x                      i                          (                                                            x                ¯                                                          j                          )        )                , which "converts the function to the new coordinates". The second is as                     f        (                  x                      i                          )        =                                            f              ¯                                      (                                                            x                ¯                                                          j                          (                  x                      i                          )        )                , which "converts back to the original coordinates. Of course, "new" or "original" is a relative concept.
There are many physical quantities that are represented by ordinary scalars, such as temperature and pressure.
Suppose the temperature in a room is given in terms of the function                     f        (        x        ,        y        ,        z        )        =        2        x        +        y        +        5                 in Cartesian coordinates                     (        x        ,        y        ,        z        )                 and the function in cylindrical coordinates                     (        r        ,        t        ,        h        )                 is desired. The two coordinate systems are related by the following sets of equations:
                    r        =                                            x                              2                                      +                          y                              2                                                                                        t        =        arctan                (        y                  /                x        )                                            h        =        z                        and
                    x        =        r        cos                (        t        )                                            y        =        r        sin                (        t        )                                            z        =        h        .                        Using                                                         f              ¯                                      (                                                            x                ¯                                                          j                          )        =        f        (                  x                      i                          (                                                            x                ¯                                                          j                          )        )                 allows one to derive                                                         f              ¯                                      (        r        ,        t        ,        h        )        =        2        r        cos                (        t        )        +        r        sin                (        t        )        +        5                 as the transformed function.
Consider the point                     P                 whose Cartesian coordinates are                     (        x        ,        y        ,        z        )        =        (        2        ,        3        ,        4        )                 and whose corresponding value in the cylindrical system is                     (        r        ,        t        ,        h        )        =        (                              13                          ,        arctan                          (          3                      /                    2          )                ,        4        )                . A quick calculation shows that                     f        (        2        ,        3        ,        4        )        =        12                 and                                                         f              ¯                                      (                              13                          ,        arctan                          (          3                      /                    2          )                ,        4        )        =        12                 also. This equality would have held for any chosen point                     P                . Thus,                     f        (        x        ,        y        ,        z        )                 is the "temperature function in the Cartesian coordinate system" and                                                         f              ¯                                      (        r        ,        t        ,        h        )                 is the "temperature function in the cylindrical coordinate system".
One way to view these functions is as representations of the "parent" function that takes a point of the manifold as an argument and gives the temperature.
The problem could have been reversed. One could have been given                                                         f              ¯                                               and wished to have derived the Cartesian temperature function                     f                . This just flips the notion of "new" vs the "original" coordinate system.
Suppose that one wishes to integrate these functions over "the room", which will be denoted by                     D                . (Yes, integrating temperature is strange but that's partly what's to be shown.) Suppose the region                     D                 is given in cylindrical coordinates as                     r                 from                     [        0        ,        2        ]                ,                     t                 from                     [        0        ,        π                  /                2        ]                 and                     h                 from                     [        0        ,        2        ]                 (that is, the "room" is a quarter slice of a cylinder of radius and height 2). The integral of                     f                 over the region                     D                 is
                              ∫                      0                                2                                            ∫                      0                                                              2                                  2                                            −                              x                                  2                                                                                      ∫                      0                                2                                  f        (        x        ,        y        ,        z        )                d        z                d        y                d        x        =        16        +        10        π                .
The value of the integral of                                                         f              ¯                                               over the same region is
                              ∫                      0                                2                                            ∫                      0                                π                          /                        2                                            ∫                      0                                2                                                                      f              ¯                                      (        r        ,        t        ,        h        )                d        h                d        t                d        r        =        12        +        10        π                .
They are not equal. The integral of temperature is not independent of the coordinate system used. It is non-physical in that sense, hence "strange". Note that if the integral of                                                         f              ¯                                               included a factor of the Jacobian (which is just                     r                ), we get
                              ∫                      0                                2                                            ∫                      0                                π                          /                        2                                            ∫                      0                                2                                                                      f              ¯                                      (        r        ,        t        ,        h        )        r                d        h                d        t                d        r        =        16        +        10        π                ,
which is equal to the original integral but it is not however the integral of temperature because temperature is a relative scalar of weight 0, not a relative scalar of weight 1.
If we had said                     f        (        x        ,        y        ,        z        )        =        2        x        +        y        +        5                 was representing mass density, however, then its transformed value should include the Jacobian factor that takes into account the geometric distortion of the coordinate system. The transformed function is now                                                         f              ¯                                      (        r        ,        t        ,        h        )        =        (        2        r        cos                (        t        )        +        r        sin                (        t        )        +        5        )        r                . This time                     f        (        2        ,        3        ,        4        )        =        12                 but                                                         f              ¯                                      (                              13                          ,        arctan                          (          3                      /                    2          )                ,        4        )        =        12                              29                                  . As before is integral (the total mass) in Cartesian coordinates is
                              ∫                      0                                2                                            ∫                      0                                                              2                                  2                                            −                              x                                  2                                                                                      ∫                      0                                2                                  f        (        x        ,        y        ,        z        )                d        z                d        y                d        x        =        16        +        10        π                .
The value of the integral of                                                         f              ¯                                               over the same region is
                              ∫                      0                                2                                            ∫                      0                                π                          /                        2                                            ∫                      0                                2                                                                      f              ¯                                      (        r        ,        t        ,        h        )                d        h                d        t                d        r        =        16        +        10        π                .
They are equal. The integral of mass density gives total mass which is a coordinate-independent concept. Note that if the integral of                                                         f              ¯                                               also included a factor of the Jacobian like before, we get
                              ∫                      0                                2                                            ∫                      0                                π                          /                        2                                            ∫                      0                                2                                                                      f              ¯                                      (        r        ,        t        ,        h        )        r                d        h                d        t                d        r        =        24        +        40        π                  /                3                ,
which is not equal to the previous case.
Weights other than 0 and 1 do not arise as often. It can be shown the determinant of a type (0,2) tensor is a relative scalar of weight 2.