<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Using binominal theorem for expression tree comparing in Intelligent Tutoring Systems</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Andrey Chukhray</string-name>
          <email>a.chukhray@khai.edu</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>David Dvinskykh</string-name>
          <email>d.dvinskykh@khai.edu</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Vitaliy Narozhnyy</string-name>
          <email>v.narozhnyy@khai.edu</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Iryna Trofymova</string-name>
          <email>i.trofymova@khai.edu</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Tetiana Stoliarenko</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>National Aerospace University «Kharkiv Aviation Institute»</institution>
          ,
          <addr-line>Chkalova 17, 61070 Kharkiv</addr-line>
          ,
          <country country="UA">Ukraine</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>In this paper, a new operation for use in a hybrid expression tree was added. The activation functions for the original and modified tree when applying binomial theorem were described. The possibilities of detecting possible errors by decomposing the expression of the original tree using binomial theorem were extended.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;Expression tree</kwd>
        <kwd>binomial theorem</kwd>
        <kwd>comparing expression tree1</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>
        In recent years, there has been a significant growth in interactive learning due to the continuous
development of computer capabilities. These include increased processor power, increased
memory capacity, increased input-output capabilities, improved networking technologies, and
increased efficiency in the development of modern software tools. The surge in machine
learning was triggered by the Covid-19 pandemic [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ].
      </p>
      <sec id="sec-1-1">
        <title>Computer-based mathematics learning programmes (CBMPs) as a means of transferring</title>
        <p>
          knowledge and skills from teachers to students are in great demand in the modern world. As
interest in these programmes grows, so do the expectations placed on them. Over time, CBMPs
have evolved from simple testing software and e-textbooks to complex Intelligent Tutoring
Systems. These systems are capable of adapting the learning process by adjusting the
parameters depending on the individual learner's characteristics [
          <xref ref-type="bibr" rid="ref4">4</xref>
          ].
        </p>
        <p>
          For such systems, it is necessary to have the ability to compare arithmetic expressions in
order to determine whether the student has made the correct expression and to determine
what errors the student has made. The previous article described a mechanism for comparing
arithmetic expressions using non-binary expression trees. It described an algorithm for tree
comparison, but there were few possibilities to analyse matched and non-matched nodes. The
system allowed to detect missed minus signs and rounding errors, and the available operations
were limited to addition, subtraction, multiplication, and division. [
          <xref ref-type="bibr" rid="ref1">1</xref>
          ]
        </p>
      </sec>
      <sec id="sec-1-2">
        <title>In equivariant transformations of expressions, one may encounter a concept called binomial theorem. Particular cases of this theorem can be applied at the subconscious level, which complicates the task of comparing the original expression given by the teacher with the modified expression in the presence of an error, which was introduced by the student.</title>
        <p>=0</p>
      </sec>
      <sec id="sec-1-3">
        <title>The binomial theorem is a result of expanding the non-negative powers of binomials or sums of two terms, where the coefficients of the terms in the expansion are the binomial coefficients. [2] The most common case of the binomial theorem is (1), where binomial coefficients as (2) [3].</title>
        <p>( +  ) = ∑ ( )     − = ( )   + ( )   −1 + ⋯ + (
)   −   + ⋯ + (
)   ,

0

1


( ) =</p>
        <p>!
 ! ( −  )!
.</p>
        <p>(1)
(2)</p>
      </sec>
      <sec id="sec-1-4">
        <title>These formulas contain an additional mathematical "exponentiation" operation in comparison with the operations described in the previous article, which determines the need to modernise the non-binary expression tree.</title>
      </sec>
      <sec id="sec-1-5">
        <title>The aim of this paper is to develop a method for finding the applied binomial theorem in the original and modified expression tree.</title>
      </sec>
      <sec id="sec-1-6">
        <title>Problems to be solved: 1.</title>
      </sec>
      <sec id="sec-1-7">
        <title>Add the possibility of storing the exponentiation operation to a certain degree;</title>
      </sec>
      <sec id="sec-1-8">
        <title>2. Determine the model for searching the presence of transformation by binomial theorem in the modified tree in comparison with the original expression tree.</title>
      </sec>
    </sec>
    <sec id="sec-2">
      <title>2. Hybrid Expression Tree</title>
      <sec id="sec-2-1">
        <title>2.1. Definition</title>
        <p>A non-binary expression tree contains incoming and outgoing nodes, indicating parent and child
nodes respectively. The child nodes had the same priority and could be shuffled at will among
themselves.</p>
        <sec id="sec-2-1-1">
          <title>The exponentiation operation has two operands, which are called base and exponent.</title>
          <p>Exponentiation does not have the commutativity property, which makes these operands not
equivalent and prevents this operation from fitting into the previous expression tree model.</p>
        </sec>
        <sec id="sec-2-1-2">
          <title>To fit this node denoting exponentiation, we need to define it as a unary operation where the</title>
          <p>only child node (in the previous non-binary expression tree definition) is the base of the degree.
An additional service node is added to denote the exponent of degree. The additional service
node is the root of a separate tree, which allows not only natural numbers but also integer
expressions to be written in the future. Since the tree contains not only ordinary child nodes,
but also service nodes, this tree will be called a hybrid expression tree in the future.</p>
          <p>
            It is necessary not to confuse a hybrid tree with a tree that contains both binary [
            <xref ref-type="bibr" rid="ref6">6</xref>
            ] and
nonbinary nodes. The node of the exponentiation operation, although it resembles a binary node,
but unlike the binary node it contains two unequal nodes, so this node is a special case of a
hybrid tree node. In the future, when expanding the possible operations of the hybrid
expression tree, the nodes will contain not only an unlimited number of child nodes, but also an
unlimited number of service nodes.
          </p>
        </sec>
      </sec>
      <sec id="sec-2-2">
        <title>2.2. Parsing expression into hybrid expression tree</title>
        <p>The basic logic of parsing an algebraic expression divided into tokens has not changed. When a
token with the value "^" is encountered, the subsequent token is written as an additional
service node, and the current node is written as the main single child node.</p>
        <p>Exponentiation has level 5 in node levels, and the final hierarchy looks like:
1. addition operation
2. subtraction operation</p>
        <p>multiplication operation
division operation</p>
        <sec id="sec-2-2-1">
          <title>5. exponentiation operation</title>
        </sec>
        <sec id="sec-2-2-2">
          <title>6. numerical node</title>
        </sec>
        <sec id="sec-2-2-3">
          <title>7. special node defining the order of operations (brackets)</title>
        </sec>
        <sec id="sec-2-2-4">
          <title>Since the current article does not consider complex numbers, obtaining a negative number in the base will cause an error and impossibility in calculating the parent nodes of the expression tree. Therefore, the cases in which a negative number in the base is obtained will not be further considered in this article.</title>
        </sec>
        <sec id="sec-2-2-5">
          <title>For the example we took expression (3), which in computer form has the form "1+(6+7)^(1+4)+5^4/(5+7)^3+3^(1+2)".</title>
        </sec>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>3. Using Multiplication formulas for polynomials to compare hybrid expressions tree</title>
      <p>The previous article described the logic for comparing nodes from the original tree to nodes in
the modified tree. This logic will not be changed to use binomial theorem, but it will be extended
to analyse redundant and missing nodes in the modified tree compared to the original tree.</p>
      <sec id="sec-3-1">
        <title>The lists of missing nodes will be searched using the activation function behind formula (4),</title>
        <p>where NG− (w ) indicates the set of child nodes of "w" node; dG− (x) is the number of child nodes of
"w" node.
origin _ activate(w) = type(w ) = pow  type(NG− (w )) = sum  dG− (NG− (w )) = 2</p>
        <p>
          If the activation function returns true, the original node is expanded using binomial theorem
and the child nodes are compared with the redundant nodes from the modified tree using the
"matching" function (5) [
          <xref ref-type="bibr" rid="ref1">1</xref>
          ]. Then all the found pairs are passed to the "sim" formula (6) [
          <xref ref-type="bibr" rid="ref1">1</xref>
          ] and
summed up. The obtained sum is divided by the value obtained from the function " Simmax " (7)
(4)
[
          <xref ref-type="bibr" rid="ref1">1</xref>
          ] in which the original node decomposed by binomial theorem was passed. The generalised
formula is shown by (8).
        </p>
        <p> 
matching (W, W* ) = (w, w*)  W  W*
 </p>
        <p> 
arg max Sim (w, w* ) Sim (w, w* )  0
wW,w*W*  
2, value(G (x)) = value(G* (x* ));

0

Simmax (G (x)), value(G (x)) = value (G* (x* ));
Sim (G(x), G* (x* )) = 0

, type(x) = value;</p>
        <p>, type(x* ) = value;

1+ (x,x*)matching(NG− (x),NG− (x*))Sim (G (x), G (x* )), type(x* ) = operation

0
type(x) = operation 
x  V (G);dG− (x) = NG− (x) .</p>
        <p>1+ Simmax (G (x)),d G−(x)  0
Simmax (G (x)) = xNG−(x) </p>
        <p>2,d G−(x) = 0
modified _ activate(G(w ) , W* ) =
(x,x* )matching(G(w),W* )Sim(G(x) ,G(x* ))</p>
        <p>Simmax (G(w ))
 0.5</p>
      </sec>
      <sec id="sec-3-2">
        <title>If both functions return true, the comparison assumes that the student has decomposed the</title>
        <p>
          expression by binomial theorem, which gives an opportunity to compare the nodes of the just
decomposed expression in the original tree and compare them with the extra nodes in the
modified tree. As a result, it returns a map [
          <xref ref-type="bibr" rid="ref5">5</xref>
          ] of correspondences between nodes to be added,
corrected, replaced, or deleted and textual support on how this should be done.
        </p>
      </sec>
      <sec id="sec-3-3">
        <title>In the previous article [1], the arithmetic expression "1*(-2)+3*4/-5+5*(3+7)" as the original</title>
        <p>expression and "1*2-3*4/5+6*(1+3)" as the modified expression were considered as an
example. For this article, the original and modified expression will be changed by adding
"(265+456)^3" and “265^3+3*265^2*456+265*456^2+456^3”. As a result, the original
expression will look like “1*(-2)+3*4/-5+5*(3+7)+(265+456)^3” (Figure 2).</p>
        <p>The modified expression will look like "1*2-3*4/5+6*(1+3)+265^3+3*265^2*456+
+265*456^2+456^3" (Figure 3).</p>
        <p>The suggestion for transforming original expression tree to modified expression tree is
shown in Figure 3. It shows that all nodes are matched except for:
• “6” and this should be replaced with “5”;
• “1” and this should be replaced with “7”;
• “265*456^2” and this non-matched node should be corrected by adding additional “3”
operand to multiply operation;
• “1*2” which should be fixed by adding minus.</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>Conclusions</title>
      <p>This system is unique and has no analogues to date, so it is impossible to provide a comparative
characteristic with known analogues. In this paper, the existing non-binary tree model was
improved by introducing a hybrid tree to be able to use exponentiation node.</p>
      <sec id="sec-4-1">
        <title>When comparing hybrid trees, the comparison model was improved by using binomial</title>
        <p>theorem. Functions were also implemented to determine usage of binomial theorem in the
modified expression tree in order to decompose the expression for further comparison. Without
using the binomial theorem, the comparison model would show the error in the decomposition
of a sum of two variables of non-negative integer degree, even if the error is elsewhere in the
arithmetic expression.</p>
      </sec>
      <sec id="sec-4-2">
        <title>Future articles will apply the expression tree to learn solving systems of linear equations using Cramer's method.</title>
      </sec>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>A.</given-names>
            <surname>Chukhray</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Dvinskykh</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V.</given-names>
            <surname>Narozhnyy</surname>
          </string-name>
          , and T. Stoliarenko, “
          <article-title>Using an expression tree for adaptive learning</article-title>
          ,
          <source>” in 2023 13th International Conference on Dependable Systems, Services and Technologies (DESSERT)</source>
          ,
          <year>2023</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>P.</given-names>
            <surname>Corn</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H. Z.</given-names>
            <surname>Vee</surname>
          </string-name>
          , and
          <string-name>
            <given-names>K.</given-names>
            <surname>Jaiswal</surname>
          </string-name>
          , “Binomial Theorem,” Brilliant.org. [Online]. Available: https://brilliant.org/wiki/binomial
          <article-title>-theorem-n-choose-k/.</article-title>
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>E. W.</given-names>
            <surname>Weisstein</surname>
          </string-name>
          , “Binomial Theorem.” [Online]. Available: https://mathworld.wolfram.com/BinomialTheorem.html.
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>A.</given-names>
            <surname>Chukhray</surname>
          </string-name>
          and
          <string-name>
            <given-names>E.</given-names>
            <surname>Yashina</surname>
          </string-name>
          ,
          <article-title>Models and software for intelligent web-based testing system in mathematics</article-title>
          , vol.
          <volume>3003</volume>
          .
          <string-name>
            <surname>CEUR-WS</surname>
          </string-name>
          ,
          <year>2021</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>Y. D.</given-names>
            <surname>Liang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Bethely</surname>
          </string-name>
          , and
          <string-name>
            <given-names>G. S.</given-names>
            <surname>Walia</surname>
          </string-name>
          , “
          <article-title>Visualizing recursion using code and stack animation</article-title>
          ,
          <source>” Journal of Computing Sciences in Colleges</source>
          , vol.
          <volume>37</volume>
          , no.
          <issue>4</issue>
          , pp.
          <fpage>41</fpage>
          -
          <lpage>49</lpage>
          ,
          <year>2021</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>L.</given-names>
            <surname>Wang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Wang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Cai</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Zhang</surname>
          </string-name>
          , and X. Liu, “
          <article-title>Translating a math word problem to a expression tree</article-title>
          ,
          <source>” in Learning 2.1</source>
          (
          <year>2007</year>
          ).
          <source>Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing</source>
          ,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>