class_docstr: Variance of a random matrix probability expression. Also known as
  Covariance matrix, auto-covariance matrix, dispersion matrix,
  or variance-covariance matrix.
  
  Examples
  ========
  
  >>> from sympy.stats import VarianceMatrix
  >>> from sympy.stats.rv import RandomMatrixSymbol
  >>> from sympy import symbols, MatrixSymbol
  >>> k = symbols("k")
  >>> A, B = MatrixSymbol("A", k, k), MatrixSymbol("B", k, k)
  >>> X, Y = RandomMatrixSymbol("X", k, 1), RandomMatrixSymbol("Y", k, 1)
  >>> VarianceMatrix(X)
  VarianceMatrix(X)
  >>> VarianceMatrix(X).shape
  (k, k)
  
  To expand the variance in its expression, use ``expand()``:
  
  >>> VarianceMatrix(A*X).expand()
  A*VarianceMatrix(X)*A.T
  >>> VarianceMatrix(A*X + B*Y).expand()
  2*A*CrossCovarianceMatrix(X, Y)*B.T + A*VarianceMatrix(X)*A.T + B*VarianceMatrix(Y)*B.T
class_docstr_tok: ["Variance","of","a","random","matrix","probability","expression",".","Also","known","as","Covariance","matrix",",","auto-covariance","matrix",",","dispersion","matrix",",","or","variance-covariance","matrix",".","Examples","========",">",">",">","from","sympy.stats","import","VarianceMatrix",">",">",">","from","sympy.stats.rv","import","RandomMatrixSymbol",">",">",">","from","sympy","import","symbols",",","MatrixSymbol",">",">",">","k","=","symbols","(","``","k","''",")",">",">",">","A",",","B","=","MatrixSymbol","(","``","A","''",",","k",",","k",")",",","MatrixSymbol","(","``","B","''",",","k",",","k",")",">",">",">","X",",","Y","=","RandomMatrixSymbol","(","``","X","''",",","k",",","1",")",",","RandomMatrixSymbol","(","``","Y","''",",","k",",","1",")",">",">",">","VarianceMatrix","(","X",")","VarianceMatrix","(","X",")",">",">",">","VarianceMatrix","(","X",")",".shape","(","k",",","k",")","To","expand","the","variance","in","its","expression",",","use","``","expand","(",")","``",":",">",">",">","VarianceMatrix","(","A","*","X",")",".expand","(",")","A","*","VarianceMatrix","(","X",")","*","A.T",">",">",">","VarianceMatrix","(","A","*","X","+","B","*","Y",")",".expand","(",")","2","*","A","*","CrossCovarianceMatrix","(","X",",","Y",")","*","B.T","+","A","*","VarianceMatrix","(","X",")","*","A.T","+","B","*","VarianceMatrix","(","Y",")","*","B.T"]
code: def __new__(cls, arg, condition=None):
      arg = _sympify(arg)
  
      if 1 not in arg.shape:
          raise ShapeError("Expression is not a vector")
  
      shape = (
          (arg.shape[0], arg.shape[0])
          if arg.shape[1] == 1
          else (arg.shape[1], arg.shape[1])
      )
  
      if condition:
          obj = Expr.__new__(cls, arg, condition)
      else:
          obj = Expr.__new__(cls, arg)
  
      obj._shape = shape
      obj._condition = condition
      return obj
  
imports: import itertools
  from sympy.core.add import Add
  from sympy.core.expr import Expr
  from sympy.core.function import expand
  from sympy.core.mul import Mul
  from sympy.core.singleton import S
  from sympy.matrices.exceptions import ShapeError
  from sympy.matrices.expressions.matexpr import MatrixExpr
  from sympy.matrices.expressions.matmul import MatMul
  from sympy.matrices.expressions.special import ZeroMatrix
  from sympy.stats.rv import RandomSymbol, is_random
  from sympy.core.sympify import _sympify
  from sympy.stats.symbolic_probability import Variance, Covariance, Expectation
label_desc: Use image node_id 1 for calling the VarianceMatrix obj's underlying member method code with example usage: obj.__new__(cls, arg, condition) and returns: obj