%% Multiplication Formula of Matrix and Scalar
% Create a 3-by-3 matrix. Multiply the matrix by the scalar coefficient K^2.

syms K A
A = [-1, 0, 1; 1, 2, 0; 1, 1, 0];
B = K^2*A

% The result automatically shows the multiplication being carried out element-wise.
% Show the multiplication formula without evaluating the operations by using displayFormula. Input the formula as a string. The variable A in the string is replaced by its values.

displayFormula("F = K^2*A")

%
% Copyright 2019 The MathWorks, Inc.